I'm trying to finish this exception handler:
if (ConfigurationManager.ConnectionStrings["ConnectionString"]==null) { string pathOfActiveConfigFile = ...? throw new ConfigurationErrorsException( "You either forgot to set the connection string, or " + "you're using a unit test framework that looks for "+ "the config file in strange places, update this file : " + pathOfActiveConfigFile); }
This problem seems to only happen to me when I'm using nUnit.
The application configuration file usually lives in the same directory as your application. For web applications, it is named Web. config. For non-web applications, it starts life with the name of App.
On assembly, an application's configuration path is set to one or more configuration directories. These directories are set from the Configuration path attributes in module manifest files.
In Solution Explorer, right-click the project node, and then select Add > New Item. The Add New Item dialog box appears. Expand Installed > Visual C# Items. In the middle pane, select the Application Configuration File template.
Try this
AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With