C#:配置文件错误
我创建了一个 .config
文件,其中没有给出任何
标记。在我的项目中效果很好。但现在,当我为项目创建单元测试用例时,它给出了一个异常,即 project.dll
没有
标记。如果我在 .config
文件中包含该标记,则项目会出现错误。我使用的是 vs-2008。我将 .config
文件创建为:
<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
....
.....
</appSettings>
如果我在 .config
文件中使用
标记,则项目中会出现错误,并且测试用例有效美好的。错误如下:
根元素必须与引用的节的名称相匹配 文件,“应用程序设置”
当我删除
标记时,单元测试用例中出现错误:
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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将
包装在
部分中。例如:You need to wrap the
<appSettings>
in a<configuration>
section. e.g.: