Re: Upgrade - Determine version
Hi Emil,
Heres an example:
<?xml version="1.0" encoding="utf-8"?>
<appSettings>
<add key="MSSQLConnectionString" value="server=(local);UID=mydbuser;PWD=mydbpassword;database=mydbname" />
<add key="SMTPServer" value="smtp.mail.yahoo.com" />
<add key="SMTPRequiresAuthentication" value="true" />
<add key="SMTPPort" value="587" />
<add key="SMTPUser" value="mysusername" />
<add key="SMTPPassword" value="mypassword" />
<add key="SSLIsAvailable" value="true" />
</appSettings>
By storing these setting in user.config I don't lose them when I upgrade and replace Web.config with the new one.
It only works for things in the appSettings section of Web.config, but settings in user.config will take priority over Web.config
However, since it only works for appSettings, I still always have to modify the system.net mailSettings section at the bottom of Web.config whenever I upgrade.
Another thing to be aware of, ASP.NET doesn't detect changes you make to user.config, it only watches the Web.config file and if it changes it will restart the app and reload the settings. So when you make a change to user.config you also must open Web.config and type a space or something to modify the file so that the new settings get loaded from user.config.
This also helps when working from svn
Hope it helps,
Joe