ConnectionString from app.config of a DLL is null

后端 未结 3 1248
闹比i
闹比i 2020-12-18 11:55

I have a class library that contains a valid connectionString inside the app.config. Inside that class library I want to use it with

ConfigurationManager.Con         


        
3条回答
  •  梦毁少年i
    2020-12-18 12:47

    I have a class library that contains a valid connectionString inside the app.config

    A class library doesn't have an app.config file associated. It's the application consuming this assembly that does. So you need to put the connection string inside this config file (if this is an ASP.NET application this would be web.config). Thus adding an App.config file in a project of type class library in Visual Studio makes no sense.

提交回复
热议问题