Visual Studios 2008 and Installer Projects

So, after pulling my hair out and lots of searches on this matter, I finally figured out the problem to my dilemma.

I have a .Net service which hits a webservice every 5 minutes or so.

I created a Windows Installer Project in order to get it deployed by my IT department.

First, my timer wasn't firing when it was supposed to fire. Why? Well, when you create a System.Timers.Timer object, and after you set all the properties.. you have to ENABLE IT! Yes, it's created with Enabled being false. You have to enable it after it's created.

The next issue I had with this whole process was harder to solve. Though it wasn't as critical to solve, it was WAY more annoying, and thus had to be fixed.

My beautiful Setup Project worked great - the first time. If you tried to upgrade it, or "repair" it, it would give an error of "error 1001" Service already installed. Some nice people on this website:

http://programmingcorner.blogspot.com/2009/02/creating-and-installing-wi...

showed me the errors of my ways, and I just had to add:

Not (Installed OR PREVIOUSVERSIONSINSTALLED)

to the conditions for my Custom Install Action.

However!

This is fun fact: Visual Studios 2008 and 2005 are different in how they create their installers. In 2005, if you have "remove previous version" set to true, it will UNINSTALL the old version before installing the new one. In 2008, it will install the new version, THEN uninstall the old version. The reasoning behind all this, is that the installer won't copy files which are the same version/timestamp. Thus an upgrade performs more like an upgrade rather than a reinstall to a newer version.

I read in some places, that the OLD version's custom actions are fired during an upgrade rather than the new actions. This could be true, as I was having nasty issues trying to troubleshoot my own problems, and it's much easier to explain those issues if I was inadvertently executing the OLD actions when trying to upgrade to the new version.

My current problem now, is trying to figure out a way to stop the service before the installer tries to copy the files over, as the files appear locked, and thus it triggers a reboot.

Another fun fact: Windows Installer Projects provide custom actions like "Install", "Commit" and actions like "BeforeInstall", "Committed". Yet, these are all misnomers. By the time the Installer calls your actions, the files are already installed!

http://msdn.microsoft.com/en-us/library/bd8h80ez%28v=VS.90%29.aspx

Anyways, this is all information that I wish I had 6 hours ago. It would have made today much more productive.

Recent comments