There are several predefined Installation components, derived from System.Configuration.Install.Installer, for handling things like installing services. You can implement custom actions as Installation Components (by deriving from Installer, specifying a few attributes, etc...) to get built-in support from both the VS.net 2003 Deployment project and the .NET SDK installutil.exe program.
The problem I ran into on Vista was that the install was being cancelled by Vista's Data Execution Prevention (DEP). Changing from a dll custom action to an EXE still resulted in the execution being cancelled (though, not by DEP). It turns out that there is a bug in the way VS.Net 2003 deployment projects construct the MSI install package.
To fix this, an application manifest needs to be embedded in the custom action executable. This manifest specifies a requiredPrivileges token (we're using "asInvoker") that is needed for the custom action executable to run during an install. Unfortunately, on VS.Net 2003, I haven't found an easy way to embed the application manifest in the custom action executable. One way of embedding this manifest in the executable is to open the executable in visual studio and manually import the manifest. An example, with steps, follows.
The manifest itself is taken from the "Vista Developer Story" (step 6).
To embed this manifest in the executable:
- Build the executable
- In visual studio use File - Open to open up the executable.
- Right click the executable and choose "Add Resource"
- Choose "Import"
- enter RT_MANIFEST then click ok
- Change the ID property to 1
- Save the executable.
- Leave the executable open so that the deployment project can't overwrite the executable.
This procedure will need to be done each time to update the embedded resource