App.config and csc.exe

本文关键字:exe csc and config App | 更新日期: 2023-09-27 17:57:40

我创建了一些C#控制台程序来测试MSSQL数据库中的存储过程。我将连接字符串存储在app.config中的数据库中。项目中的每个类都引用连接字符串,但它们都有一个主方法,所以我编写了以下脚本来进行编译:

@echo off
SET csc=C:'WINDOWS'Microsoft.NET'Framework'v4.0.30319'csc.exe /nologo
SET tgt=/target:exe
SET cfg=/appconfig:app.config
%csc% /out:Update_Workorder_Status %cfg% %tgt% Update_Workorder_Status.cs
%csc% /out:Get_Workorders_By_User %cfg% %tgt% Get_Workorders_By_User.cs
%csc% /out:Get_Workorders_By_Customer %cfg% %tgt% Get_Workorders_By_Customer.cs

我得到这个错误:

CS0103"名称"Properties"在当前上下文中不存在。"

我需要额外的东西来通过编译器吗?

App.config and csc.exe

似乎您的类使用Visual Studio生成的资源文件或设置,因此您需要添加Properties'SomeFile.Designer.cs

有一个名为Settings.Designer.cs的VS生成的文件,它可能是必需的