简体   繁体   English

app.config错误“损坏或包含无效的XML”?

[英]app.config error “corrupted or contain invalid XML”?

After many tries of trying to fix this error message, I still cannot manage to fix it and it only appears when I try to add a property to Settings.settings: 经过多次尝试修复此错误消息后,我仍然无法修复此错误消息,并且仅当我尝试向Settings.settings添加属性时才会显示该错误消息:

An error occurred when saving values to the app.config file. 将值保存到app.config文件时发生错误。 The file might be corrupted or contain invalid XML. 该文件可能已损坏或包含无效的XML。

Yes, I have looked for a fix online already but I haven't found a solution because I haven't even messed with my app.config file whatsoever. 是的,我已经在网上寻找修复程序,但是我没有找到解决方案,因为我什至没有弄乱我的app.config文件。 Here is my app.config file code: 这是我的app.config文件代码:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
    </startup>
</configuration>

Open the App.config and try one of the following: 打开App.config并尝试以下操作之一:

  1. Check its syntactic correctness using an XML checker like this 使用XML检查器检查其句法正确性这样
  2. When you get no syntax errors, check for logical errors like two sibling tags with the same name or bool tag with default value of string type .. 如果没有语法错误,请检查逻辑错误,例如两个具有相同名称的同级标记或默认值为字符串类型..的bool标记。
  3. Last solution would be to copy the xml schema of App.config file from another similar application and manually add your settings 最后的解决方案是从另一个类似的应用程序复制App.config文件的xml架构,然后手动添加设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM