error in config file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi!

My Windows application is developed with VS 2003. It uses an app.config
file to read the path and name of my MS SQL Server database. It works fine
with .net framework 1.1, but...

<?xml version=1.0">
<configuration>
<appSettings>
<add key="SERVER" value="127.0.01"/>
</appSettings>
<appSettings>
<add key="DATABASE" value="myDB"/>
</appSettings>
</configuration>

When I try run my application on a computer with only .net framework 2.0 I
receive a message "error in config file".

Why is this and how do I solve this problem? I thought that an application
developed in .net framwork 1.0 environment also was able to run in a .net
2.0 environement.

Best regards
Hans Årsjö
 
You only need the one <appSettings> section. You may also want to take a
look at the <connectionStrings> section.

Glenn
 
This should actually be

<?xml version=1.0">
<configuration>
<appSettings>
<add key="SERVER" value="127.0.01"/>
<add key="DATABASE" value="myDB"/>
</appSettings>
</configuration>

Both in 1.1 and 2.0
 
Thank you Glenn!

I'm sorry for not replying earlier. Your solution helped a lot. My only
problem now is that I don't have the right version for "crystal reports
runtime .net" and "Crystal reports 9". (for redistribution in my MSI package).

Best regards Hans
 
Thank Morten for your reply!

The bad guy in my case is InstallShield Professional version 11. When I run
the MSI file build with InstallShield it creates a XML/config file during the
installation. If the file exists from before it only adds several
<appSettings></appSettings> and it doesn't overwrite existing values.

Best regards
Hans
 
I ment that my problem ixist if I want to run our application in an
evironement with only .NET framwork 2.0 installed

/Hans
 
Back
Top