I'm trying to save some settings (such as my connection) string in a .config file. Most of the tutorials I see online on how to create a .config file state that I should manually add an existing one, but my program has already created one automatically and I have the following code inside it:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup><system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient"/>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc812dsac44d"/>
</DbProviderFactories>
</system.data></configuration>
Now when I click the properties of my app.config file I get no error messages. But when I just click inside the text area I get the following 3 messages:
Could not find schema information for the attribute 'version'.
Could not find schema information for the attribute 'supportedRuntime'.
Could not find schema information for the attribute 'sku'.
So I created another app.config file and named it 'app2.config'. But when I copy the following code
<appSettings>
<add key="path226" value="Application.StartupPath" />
</appSettings>
and try to retrieve the value by this code
MessageBox.Show(ConfigurationManager.AppSettings["path226"]);
I get a blank message box. If I try the same code within 'app.config' it works but I get the 3 error messages. I'm not sure whether I have to create my own app.config file or use the existing one. And If I have to use the existing one how can I solve my error ? Thanks for the help.