I am using the Visual Studio 2005 web setup project wizard to create an MSI-based installer for my web application. The application installs fine on Windows XP and Windows Server 2003, but I am running into some issues on Windows Vista. When I run my MSI from an elevated command prompt, it installs correctly. However, when I just double-click on the MSI to run it, setup fails.
I looked in the verbose MSI log file and found that the custom action named WEBCA_SetTARGETSITE is failing with an error stating that it did not have sufficient permissions to complete correctly. As a result, I tried to use the script named customaction_noimpersonate.js that you described in this blog post to add the NoImpersonate flag to the custom action attributes.
However, that did not help and I am still not able to install my MSI on Windows Vista without elevating it. How can I fix my MSI so that it will work in this scenario?
The custom actions added to the MSI by the Visual Studio 2005 web setup project wizard require administrative privileges in order to complete successfully. In addition, the WEBCA_SetTARGETSITE is a standard (immediate) custom action, and it is only possible to add the NoImpersonate flag to deferred custom actions. Also, if you look at the source code for the customaction_noimpersonate.js script, you will see that it only updates deferred custom actions when setting the NoImpersonate flag.
This means that you must do one of the following in order for this type of MSI to install correctly on Windows Vista:
- Use a setup bootstrapper that prompts for elevation prior to launching the MSI. The Visual Studio 2005 setup projects include a setup.exe bootstrapper that will prompt for elevation, or you can write your own setup bootstrapper.
- Launch the MSI from an elevated command prompt
Both of these options will ensure that the MSI will have the necessary permissions by the time it tries to execute the WEBCA_SetTARGETSITE immediate custom action.
One other note - when installing on Windows Vista, the WEBCA_SetTARGETSITE custom action also requires that the IIS6 Management Compatibility item be installed as part of IIS7 on Windows Vista. You can see this blog post for more information about IIS6 Management Compatibility and how to enable it on Windows Vista.
<update date="5/18/2007"> Added a note that the Visual Studio 2005 setup bootstrapper can be used to prompt for elevation </update>