Configuration File in C# default location?

巧了我就是萌 提交于 2019-12-07 17:45:17

问题


I have just created a WPF application and just been wondering where is my app.config file?

I looked in the bin/Debug and bin/Release directories and there is just one file "WpfApplication1.vshost.exe" and could not find any app.config file.

All I can do is Add->New Configuratin File and this too, doesn't come in debug or Release folder.

Can anyone guide me whether I should manually copy and paste it in the debug or Release Folder?

So finally: the ANSWER

If app.config does not exist, then try creating a new one by "Add->New Item->Application Configuration File" and create a file named "App.config". After this, try rebuilding your application, the .config file specific to your project should appear in bin/Debug & bin/Release folder.


回答1:


It should be getting copied into the Debug/Release folders automatically. However, you could try explicitly setting the "Copy to output directory" in the properties to Copy always and see if it appears.




回答2:


After creating simple WPF project my solution look like this. App.config lies there, which is the configuration file itself

When you build your solution, which in my case is named as WpfApplication1, config file lies at WpfApplication1.exe.config in \WpfApplication1\bin\Debug\ folder.




回答3:


When you build your application,it automatically gets copies to debug/Release Folder.just look for *.config file in those folders.




回答4:


If you build your project you should have a file named foo.bar.exe.config in you binary directory. The app.config file itself should be visible within your solution directory.



来源:https://stackoverflow.com/questions/14194114/configuration-file-in-c-sharp-default-location

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!