I have a project in my solution that is a class library. I have two console applications in the solution that reference this library. There is an App.config in the library that I have added by link to the console applications and everything is great.
I just added a web application to the solution and referenced the class library. The class library has multiple references along the lines of var foo = ConfigurationManager.AppSettings["Foo"];
. This works fine in the console applications, but when running the web application I get an exception that "Value cannot be null. Parameter name: value"
on the line for the ConfigurationManager
access.
I've modified my web.config to match the below:
<configuration>
<appSettings file="App.config">
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
I've added the app.config
as an existing object to the web application project as a link. I've set it to always copy when building.
I've looked at this and that am still cannot get things to work.
For additional clarification. Web Application calls a method in a class library. The class library uses ConfigurationManager
. This fails. In the same solution there are Console Applications that do the same thing and work.