I have a WPF/C# application that I have created using Visual Studio 2012 to which I added a typed DataSet through the wizard.
Everything went smoothly, I could run everything over and over without any issues, until suddenly, I can't compile the solution anymore, I get the following errors inside the file App.config:
Error 3 Unrecognized escape sequence [...]\App.config 7 56 Contabilità Chiurlo v4 Warning 1 The 'configuration' element is not declared. [...]\App.config 2 2 Contabilità Chiurlo v4 Error 2 A namespace cannot directly contain members such as fields or methods [...]\App.config 1 1 Contabilità Chiurlo v4
The structure of the App.config
file, which I have never edited manually, is the following:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="SOME NAME" connectionString="MY CONNECTION STRING"
providerName="System.Data.SqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
Where, of course, SOME NAME
and MY CONNECTION STRING
represents personal data, omitted for clarity.
My knowledge of this matter is close to zero, I have searched about similar issues but they all seem referred to somehow different situations. Some of them give a hint about a lack of xmlns specification, but I wouldn't know which one to add.
Looking back at my previous projects, the App.config
file always had a similar structure, but now it is preventing me from compiling, while previously it probably only generated warnings.
What went wrong? How to fix it?
EDIT: The first error (marked as number 3), was caused by the absence of an escape character in my connection string, that had the structure C:\dir1\dir2
instead of C:\\dir1\\dir2
.
However, the other two errors (marked as 1 and 2), keep arising.