Reputation: 218752
Where does the App.config go when I publish a website using Visual Studio. I can't see it in my publish output directory.
I have the App.config created by Visual Studio when I added a web refernce to my class libaray. I want to have a editable App.config so that I don't want to rebuild everytime when I want to switch to another web service.
Upvotes: 3
Views: 6152
Reputation: 41
When you build your project, the App.Config file is copied to your Debug/Release folder with the name .exe.config. If my project is named UseAppConfig, than the App.Config in my Debug folder is UseAppConfig.exe.config Open the .config file in your working directory (Debug/Release). Change the values. In the same folder you will see your executbale. Double click on this and you should see the new values. You are all set. You can identify all those parameters that make sense as runtime parameters, define a meaningful key for each parameter and start using it. You no longer have to build your application every time you want to change the parameter value.
Upvotes: 4
Reputation: 8159
The app.config will not be published, but instead the settings will be read from the web.config file. So, if you add settings to the app.config file, you should also add them to the web.config file.
Upvotes: 0
Reputation: 351526
Your web.config file needs to live in the root directory of the application. If your application involves multiple virtual directories (i.e. nested virtual directories) then IIS will also read in any web.config files as long as they are in the roots of those virtual directories.
Remember that .NET configuration file schema also allows you to put other configuration files elsewhere and include them into the main configuration file when the application starts so that affords you some more flexibility.
Upvotes: 2