Search code examples
c#.netapp-configcsc

App.config and csc.exe


I've created some C# console programs to test my stored procedures in a MSSQL database. I'm storing the connection string to the database in app.config. Each class in the project references the connection string, but they all have a main method in them, so I've written this script to do the compile:

@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

I'm getting this error:

CS0103 "The name 'Properties' does not exist in the current context."

Is there something extra I need to pass the compiler?


Solution

  • Seems that your class uses Visual Studio-generated resources file or settings, thus you need to add Properties\SomeFile.Designer.cs