enthu
enthu

Reputation: 41

C#: Config file error

I created a .config file in which I had not given any <configuration> tag. It works fine in my project. But now when I created the unit test case for the project, it is giving an exception that project.dll doesn't have <configuration> tag. If I include the tag in the .config file the project is giving an error. I am using vs-2008. I created the .config file as:

<?xml version="1.0" encoding="utf-8" ?>
  <appSettings>
....
.....
</appSettings>

If I use <configuration> tag in .config file the error comes in the project and testcase works fine. the error comes as:

The root element must match the name of the section referencing the file, 'appSettings'

As I remove the <configuration> tag, the error comes in unit testcase as:

unit test runner failed to  load test assembly.
jetbrains.resharper.taskrunnerframework.taskexception.configuration system fail to initialize.
jetbrains.resharper.taskrunnerframework.taskexception.configuration file project.dll doesnot have <configuration> tag.

Upvotes: 0

Views: 2884

Answers (1)

Kevin McKelvin
Kevin McKelvin

Reputation: 3547

You need to wrap the <appSettings> in a <configuration> section. e.g.:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
   <appSettings>
    ...
   </appSettings>
</configuration>

Upvotes: 7

Related Questions