G'day,
I've discovered an interesting problem with the my.settings namespace and my deployment strategy. I was hoping for some feedback from the group.
Senario
- VS 2003 solution upgraded to VS2005.
- VB.net 2005 windows form solution with a GUI project + .snk (strong name signature). Windows application framework settings selected in the project. The GUI project is signed to allow licensing to be inserted into the application.
- VS2005 MSI package in release mode for deployement to \\Program Files\My Company Name\Product Name\ folder for general users. Independant MSI Product Code.
- VS2005 MSI package in deploying Application debug symbols for testing to \\Program Files\My Company Name\Product Name Testing\ which deploys the debug symbols for users that test the software. Independant MSI Product Code.
- The application has a database connection string (path) in the my.settings config file.
- The build process uses Nant .85c and Devenv.exe command line options to build the solution and MSI packages.
- I've added code in the ApplicationEvents.vb Startup method to upgrade the previous installation settings, so the users don't have to find the databases again. Eg.
Private
Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
' Reset any user set values from previous installations.
With My.Settings
If .FirstRun = True Then
.Upgrade()
.FirstRun =
False
.Save()
End If
End With
End Sub
Result
- Both applications install and upgrade the application components correctly.
Problem
The storage of user configuration values in C:\Documents and Settings\User Name\Local Settings\Application Data\My Company\Product Name.exe_StrongName_3cggbgn1tqd0sa0ueq0t2grjblmkk5ye\x.x.x.x\user.config is the same for both applications because both msi installation projects draw from the same GUI project and hence contain the same strong name. This creates a problem, because there are different databases for testing and production versions of the database. So how do I get independent versions of the my.settings user.config if we are really opening two different applications?
This also raising a really uggly concern that the my.settings namespace breaks copy and paste deployment. Have I missed something here?