[英]C#: Config file error
I created a .config
file in which I had not given any <configuration>
tag. 我创建了一个
.config
文件,其中没有给出任何<configuration>
标记。 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. 但是现在当我为项目创建单元测试用例时,它给出了一个例外,即
project.dll
没有<configuration>
标记。 If I include the tag in the .config
file the project is giving an error. 如果我在
.config
文件中包含该标记,则该项目给出了错误。 I am using vs-2008. 我正在使用vs-2008。 I created the
.config
file as: 我将
.config
文件创建为:
<?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. 如果我在
.config
文件中使用<configuration>
标记,则该错误将出现在项目中,并且测试用例可以正常工作。 the error comes as: 错误如下:
The root element must match the name of the section referencing the file, 'appSettings'
根元素必须与引用文件“ appSettings”的部分的名称匹配
As I remove the <configuration>
tag, the error comes in unit testcase as: 当我删除
<configuration>
标记时,单元测试用例中的错误如下:
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.
You need to wrap the <appSettings>
in a <configuration>
section. 您需要将
<appSettings>
包装在<configuration>
部分中。 eg: 例如:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
...
</appSettings>
</configuration>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.