简体   繁体   中英

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:

An error occurred when saving values to the app.config file. The file might be corrupted or contain invalid 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. Here is my app.config file code:

<?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:

  1. Check its syntactic correctness using an XML checker like this
  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 ..
  3. Last solution would be to copy the xml schema of App.config file from another similar application and manually add your settings

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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