countrymeister
asked on
Unable to read app.config in WPF application
I am getting the following error while trying to read an app.config file from my wpf application
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appsettings>
<add key="Environment" value="DEV"/>
</appsettings>
<startup>
<supportedRuntime useLegacyV2RuntimeActivati onPolicy=" true" version="v4.0" sku=".NETFramework,Version =v4.0" />
</startup>
</configuration>
The invocation of the constructor on type XYZ that
matches the specified binding constraints threw an exception.' Line number '7' and line position '48'.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appsettings>
<add key="Environment" value="DEV"/>
</appsettings>
<startup>
<supportedRuntime useLegacyV2RuntimeActivationPolicy="true" version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
</configuration>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appsettings>
<add key="Environment" value="DEV"/>
</appsettings>
<startup>
<supportedRuntime useLegacyV2RuntimeActivati
</startup>
</configuration>
The invocation of the constructor on type XYZ that
matches the specified binding constraints threw an exception.' Line number '7' and line position '48'.
ASKER
still getting the same error , here is the updated config file
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appsettings>
<add key="Environment" value="DEV"/>
</appsettings>
<startup useLegacyV2RuntimeActivati onPolicy=" true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version =v4.0" />
</startup>
</configuration>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appsettings>
<add key="Environment" value="DEV"/>
</appsettings>
<startup useLegacyV2RuntimeActivati
<supportedRuntime version="v4.0" sku=".NETFramework,Version
</startup>
</configuration>
ASKER
Ok, I figured out this issue appsettingsis not correct it should be appSettings. XML is case sensitive
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for countrymeister's comment #a39460511
for the following reason:
I found the solution myself
Accepted answer: 0 points for countrymeister's comment #a39460511
for the following reason:
I found the solution myself
Actually, you have two errors and I solved the one you asked in this question. My points please.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I gave mas_oz2003 ample time to reply why he should be granted the points.
I also gave an example of my solution without his suggested code which works
I also gave an example of my solution without his suggested code which works
Open in new window