November 06, 2006

Setup Programs Installer creation using VS2005

Setup Programs Installer creation using VS2005
Getting Started with Setup Projects (SimpleTalk).
Visual Studio Setup Projects and Custom Actions (Simple Talk).
Updates to Setup Projects (SimpleTalk).

To create an Installer using Visual Studio you must create a Setup Project. A setup project contents are files and outputs of other projects in the solution. The Setup Project template can be found in the Visual Studio New Project dialog under Other Projects->Setup and Deployment->Setup Project.

Tip! To debug installation or just see what's happening in the background and view system variable values use the msiexec logger, it logs everything that's happening on installation, it can also be used for uninstall
msiexec /i yourinstaller.msi /l* yourinstaller.log
or verbose
msiexec /i yourinstaller.msi /l*v yourinstaller.log

msiexec /uninstall yourinstaller.msi /l* yourinstaller.log
or verbose
msiexec /uninstall yourinstaller.msi /l*v yourinstaller.log

Description of how to create a Setup Project
Deploying Windows Applications (Charp Onlline .NET).

You'll see that the Setup Project (note there's also a WebSetup project template) supplies the dialogs etc for user info entry, I don't think there's a way to override this. The dialogs allow limited user input. The user input from the dialogs textfields is available to you through Properties, I'll talk about how to access them now.
Setup Project Property Reference (msdn).
This is all done for you but there are a couple of things to look out for, as always if you wish to do something different it's tricky. For example if you wish to get some information on the Installation you must use a Custom Action.

Updating/Patching the installation
Updates to Setup Projects (SimpleTalk).
It doesn't appear that this is implemented all that well with Visual Studio setup projects, they don't have the power.
The SimpleTalk link gives instructions on the ways to implement update packages but it does mention that patching (just updating certain files) is not implemented, it's a full install/reinstall or nothing, even the repair does this.

Merge Modules
Installing Shared Components using Merge Modules (msdn).
The contents of the Setup Project can be broken up into Merge Modules. The Merge Modules contain Components, the components contain your installer items.
The Merge Modules are a useful tool if you wish to add contents to your installer from other resources such as projects outside of your current solution, if you wish to import outputs from a project in a location outside of your present solution then create a new Merge Module project in the other solution and then add the Merge Module to the current Setup Project.

MSBuild and Setup Projects

Word of warning on Setup Project (.vdproj). MSBuild will not build these type of projects. The result is a warning in MSBuild ... and the contents (the Outputs of other Projects which the Setup uses) are not updated, it could install older versions of files than you had hoped.

One solution would be to Build the Setup project manually after running MSBuild.

Another solution is to tell devenv to explicitly build the Setup project
There are 2 ways to do this:
  1. On the command line, e.g in your build script with
  2. In another project file tell devenv to build the project using devenv

To Force an uninstall try this
MsiExec.exe /I installer.msi REINSTALLMODE=voums REINSTALL=ALL
installer.msi is the name of your installer. The Repair/Remove dialog will appear and you can then Remove.

No comments: