开发者

Prevent app.config from being created in a Class Library

Background: I've created a Visual Studio 2010 solution with a separate project for a Web Application project and Class Library for the business logic. I want the connections and other application settings defined开发者_如何学运维 within Web Application project and not have a config file for the Class Library. Something within the Class Library continues to recreate the app.config file even after I've deleted the file. My guess it is related to the LINQ to SQL dbml files.

Question Does anyone know of a way to prevent the app.config from being auto generated in a Class Library?


You can't prevent app.config being generated.

I see no problem with Class library having it's own config file. I do MVC Web projects (same as winforms, webforms or any other project type) with numerous Class libraries each having it's own app.config.

Connection strings are stored only in main MVC project. Upon deployment either don't deploy those config files or delete connection strings from them. As long as they (connection strings) have the same name, class library will find it in main project's config and use it from there.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜