Note that there are some explanatory texts on larger screens.

plurals
  1. POApp.config seems to be ignored
    text
    copied!<p>I've this Class Library, as a result of a refactor action. I added an App.config file and added something like this:</p> <pre><code>&lt;configuration&gt; &lt;connectionStrings&gt; &lt;add name="MyDatabase" connectionString="Data Source=server;Initial Catalog=database;User ID=userid;Password=password" providerName="System.Data.SqlClient" /&gt; &lt;/connectionStrings&gt; &lt;/configuration&gt; </code></pre> <p>But when I run the application, debugging learns me this is totally ignored. The immediate window tells me: </p> <pre><code>ConfigurationManager.ConnectionStrings[0] {data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true} base {System.Configuration.ConfigurationElement}: {data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true} ConnectionString: "data source=.\\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" Key: "LocalSqlServer" Name: "LocalSqlServer" Properties: {System.Configuration.ConfigurationPropertyCollection} ProviderName: "System.Data.SqlClient" </code></pre> <p>I've checked generated config file in the bin directory and its contents are identical to the App.config.</p> <p>I try to read the App.config using: </p> <pre><code>ConfigurationManager.ConnectionStrings[Constants.Connections.DevConnection].ConnectionString </code></pre> <p>Nothing out of the ordinary I'd say, but what is going wrong? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload