开发者

What happens to the app.config file once I reference the class library

开发者 https://www.devze.com 2023-04-12 06:51 出处:网络
I have a class library with a app.config file with 4 settings in it. Previously when I tried this (VS2008) as soon as I referenced the library I would not be able to access the config file/application

I have a class library with a app.config file with 4 settings in it. Previously when I tried this (VS2008) as soon as I referenced the library I would not be able to access the config file/application would break, but for some reason it works now. I have referenced the library in 3 applications and I can still access the setting开发者_如何转开发s fine but the actual config file is missing.

Does the config file get compiled along with the library as soon as you reference it or what happens to it?

(working in vs2010)


It probably works because there are defaults in the generated Settings.Designer.cs file. The more important question would be: How can I change my settings?

And that would require copying or merging the relevant XML sections from the library app.config to that of the referencing application.


The config file is renamed; "app" is replaced by the name of your assembly. So if your app.config is associated with a program, say Foo.exe, then in your output folder (eg bin\debug) you should have a Foo.exe.config. If your app.config is associated with a class library, say Bar.dll, then in the output folder it will be Foo.dll.config.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号