Last weekend I did a full upgrade on my computers to Windows 8. Along with that, came the upgrade of Visual Studio 2012 and SQL Server 2012, and Team Foundation Server 2012. My plan was to have a completely fresh development environment, with no legacy 2010, 2008, 2005 versions.
This was a good plan, but I had one reservation. In this year, I converted from Visual Source Safe to TFS 2010, and now I was going to have to upgrade again to TFS 2012. Everyone understands how to manage a big file system structure like VSS, but TFS might be a mystery. Actually, it’s much easier. It’s just two SQL databases. So I backed up those databases and did my full, fresh install.
Now I’m ready to install TFS 2012, but what about my data? I’d seen many blogs and articles describing the upgrade process. Every one said, uninstall TFS 2010, then install TFS 2012. But I didn’t want to have any TFS 2010 bits on the new install. So in order to get the database instance to restore my TFS 2010 data, I installed TFS 2012, then uninstalled it. Then I restored my TFS 2010 data into the SQLEXPRESS instance TFS created. Finally, I reinstalled TFS 2012, selecting the “Upgrade” option, which converted my TFS 2010 data to the new schema.
Sounds like a roundabout solution but it worked without any problems and without resorting to older product installs.
A pretty common feature in applications is the ability to automatically update when a new version is available. Of course many designs have been created to address this, from having pre-launchers, to ClickOnce, to web services, to notifications, and on and on. There’s plenty of ways to solve the problem, each with its own set of benefits and drawbacks.
The design I recently faced was one where the app would launch, check the database for a new version and if one existed, would display a notification, launch the installer and exit the application. A couple of things were less than ideal with this. First, the installer would be the standard interactive install, so you got used to hitting Enter 3 times to jump through the screens. Second, after install, you’d need to relaunch the application. So I decided to try and resolve these issues.
The first step I thought would be easy. I would launch the install using MSIEXEC and use the /QR to make the install non-interactive. This seemed really nice until a bug surfaced where the /QR switch would not perform an uninstall of the previous version, resulting in multiple entries in the Add/Remove Programs list. This bug was reported back in 2010 and with VS 2012 coming out, I guess it will never be resolved. With a lot of trial and error, since there seems to be no workaround for the problem on the Internet, I found that the /PASSIVE switch will uninstall the old version, so that was my new plan. However, with /PASSIVE, there is no notification the install is complete. That’s fine for now, because I was going to make the app relaunch after completion.
After a lot of study on custom actions, I got the application to launch after the install. Now I have a problem where the application is being launched as SYSTEM instead of the current user. This would make the database access fail. More trial and error, because there doesn’t seem to be any info on this issue either, and I found that when you choose the InstallAllUsers=true option, MSIEXEC runs as SYSTEM, which makes sense since it would need access to write to the All Users sections. But if you set InstallAllUsers=false, then MSIEXEC runs as the current user, which then would launch the application as the current user and all would be well. That is, if you’re willing to give up the All Users install.