Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio
All postings are provided AS IS with no warranties, and confer no rights. Additionally, views expressed herein are my own and not those of my employer, Microsoft.
Question:
I have built an MSI-based setup for my application that includes the merge module for the Visual C++ 8.0 CRT (msvcrt80.dll). In addition, the MSI contains a custom action that has a dependency on the Visual C++ 8.0 CRT. I have been able to successfully install this MSI on Windows XP, Windows Server 2003 and Windows Vista in the past.
Recently, I updated my development system to Visual Studio 2005 SP1. After I did this and rebuilt my MSI, I am no longer able to install my MSI on Windows Vista. The custom action that depends on the VC 8.0 CRT no longer runs correctly.
Why did this error just start happening, and how can I resolve it so that I can install my MSI correctly on Windows Vista?
Answer:
As I previously described in this blog post, an MSI that installs any of the VC 8.0 runtime files and also includes custom actions that depend on the VC 8.0 runtime files can run into problems.
To briefly summarize that blog post, on Windows Vista, the VC 8.0 runtime files are installed as global assemblies using the MsiAssembly and MsiAssemblyName tables. When global assemblies are installed during an MSI-based setup, they are not fully published and available for use on the system until after the InstallFinalize standard action. This means that if an MSI installs the VC 8.0 runtime files and also includes custom actions that depend on the VC 8.0 runtime files, then the custom actions must be scheduled after InstallFinalize in order to be guaranteed to not run into dependency issues on Windows Vista.
The reason why the MSI happened to install correctly on Windows Vista prior to updating your development system to Visual Studio 2005 SP1 is that Windows Vista includes the .NET Framework 2.0, and the .NET Framework 2.0 installs the VC 8.0 CRT (msvcrt80.dll). This means that the CRT was already present on the system and the custom action in your MSI was able to run correctly as a result. However, once this MSI is rebuilt using Visual Studio 2005 SP1, the custom action now depends on the VS 2005 SP1 version of the VC 8.0 CRT, which does not ship with the .NET Framework 2.0 and is therefore not on Windows Vista by default. In this case, your MSI will install the CRT as a global assembly, and the CRT will not be fully published and ready to use until after the InstallFinalize action.
In order to resolve this issue, you will need to do one of the following:
<update date="5/20/2007"> Added an option to compile the custom action with the _USE_RTM_VERSION variable defined </update>
Alternatively, you can compile your code with #define _USE_RTM_VERSION, which causes it to always depend on the RTM version (8.0.50608.0) of the CRT, regardless of which version of Visual Studio you use.
Hi Rlipscombe - Thank you for the heads up about this option, I will add it to the list on the main blog post.
Any chance Windows Installer will ever just fix MsiPublishAssemblies?
Windows Installer custom actions that launch executables (base custom action type msidbCustomActionTypeExe
PingBack from http://msdnrss.thecoderblogs.com/2007/10/24/exe-custom-actions-are-bad-4/
PingBack from http://msdnrss.thecoderblogs.com/2007/10/24/exe-custom-actions-are-bad/
Hi Aaron,
I posted a question @ social.msdn.microsoft.com/.../7b544964-a5c0-40f9-a91b-46a9889b440a . Can you explain the reason behind the failure in registration.
Thanks
Hi OnsAdb - This is essentially the same issue as the one I described at blogs.msdn.com/.../problems-with-custom-actions-that-depend-on-the-visual-c-8-0-runtime-files-on-windows-vista.aspx. If you install the VC++ runtime files within your MSI using the merge modules and then have an action later in the same MSI, you may encounter errors because the VC++ runtime files are not yet fully installed. There are a few options listed in that other blog post for working around this type of issue, so hopefully one of them will be an option for you in this scenario.