开发者

VB.NET Class Library dll.config File

My que开发者_运维百科stion is on config files, or dll.config for a class library project (dll). Does the dll have to be compiled for the changes in the config file to take affect?

The problem I've noticed is that I add a reference to another solution to my dll, and it still has a connection string that points to the test database, even though I've updated it in the config file.

If it does have to be compiled, what's the point of having a config file?


You need to copy the config elements form the App.config of the DLL to the config file of the application that is referencing the DLL. If you reference the DLL in a WebApp then you need to copy the elements to the web.config. If you reference in the WinApp then you need to make sure that the WinApp has a config file and copy the elements to that file.


DLL's (Class Libraries) don't use config files. You'll need to set the configuration data via the application's config file.

You could, if you really want to, have a class library use a config file, but I don't think that's best practice and kind of defeats the purpose of the class library, IMO.


No, the dll does not have to be compiled for your config changes to take affect.

If your dll file reads from a config file (app.config or web.config), than it will read the config file of the executable that is referencing it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜