Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

c#: config file in bin\debug folder

Tags:

c#

I kept getting errors in my log file that messageconfig file not found. It turned out that my application was expecting it in the bin\debug folder. What causes the application to expect so? It seems that when project is built it should copy the config file in bin\debug folder. Am i missing a certain project setting?

like image 871
dotnet-practitioner Avatar asked Oct 05 '10 18:10

dotnet-practitioner


2 Answers

App/web.Config files are expected to be in the same directory as the application/web root.

Other, referenced config files may be in other directories, as specified in the main configuration file.

If you right click on the .config file, then on properties there is a Copy to Ouput Directory entry.

This should be set to either Copy if Newer or Copy always, if this is set to Do not copy, the .config will not by copied to the debug/release folder where it is expected.

like image 70
Oded Avatar answered Oct 03 '22 19:10

Oded


Config files are expected to be in the same location as the executing assembly.

Check out this SO question: .NET 2.0 Application Settings (user.config) file location

like image 26
Sam Trost Avatar answered Oct 03 '22 18:10

Sam Trost