开发者

[myproject].dll.config files - do I need them?

If I have a project with an App.Config, and when I compile it I get a file next to my DLL called [myproject].dll.config which co开发者_运维技巧ntains the contents of the projects App.Config.

If I want to reference [myproject].dll from another project, do I need to copy the .config file as well? Can the App.Config file be compiled into the DLL so all that is required is the DLL itself?


When you actually run your app, the only config file it will read is the YourExeName.exe.config. It won't look at any yourdll.dll.config files. You need to put everything that needs to be used into the YourExeName.exe.config file.

However, .net settings will automatically compile the default into the .dlls so you don't need to worry about them unless you want to set them to something other than the default you specified, but connection strings or anything like that will need to be placed in yourexe.exe.config.


The App.Config is a separate entity that cannot be compiled into the DLL. What you can do, however, is load the dll in a separate domain and associate the config file with it there. I blogged about this here.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜