R – Microsoft VC Runtime Requirement and SXS error for Setup Custom Action in Vista

runtimesetup-projectvisual studiowindows-vista

I created a setup project with VS2005 for an application that I'm developing, which installs fine on Windows 2000 and XP, but when I try to run the installer on Vista, it gives the following error:

There is a problem with this Windows
Installer package. A program required
for this install to complete could not
be run.

This error occurs at the very end of the install process, after it has already copied all of the files over to the disk, and it's occurring when it tries to run my custom actions executable.

The custom actions binary is a file called InstallCustom.exe, and is written in C++. It is very basic, and just handles the Install, Commit, Uninstall, and Rollback actions and does nothing more than set some registry entries and fire off a couple batch scripts to finalize the install.

I ran SXSTrace during the install to see what it was failing on and got the following trace:

=================
Begin Activation Context Generation.
Input Parameter:
    Flags = 0
    ProcessorArchitecture = x86
    CultureFallBacks = en-US;en
    ManifestPath = C:\Program Files\MyApp\InstallCustom.exe
    AssemblyDirectory = C:\Program Files\MyApp\
    Application Config File = 
-----------------
INFO: Parsing Manifest File C:\Program Files\MyApp\InstallCustom.exe.
    INFO: Manifest Definition Identity is (null).
    INFO: Reference: Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053"
INFO: Resolving reference Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053".
    INFO: Resolving reference for ProcessorArchitecture x86.
        INFO: Resolving reference for culture Neutral.
            INFO: Applying Binding Policy.
                INFO: Find publisher policy at C:\Windows\WinSxS\manifests\x86_policy.8.0.microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.1434_none_516c10c30f4aae68.manifest
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC80.CRT\8.0.50727.4053__1fc8b3b9a1e18e3b\Microsoft.VC80.CRT.DLL.
                INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT.DLL.
                INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT.MANIFEST.
                INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.DLL.
                INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.MANIFEST.
                INFO: Did not find manifest for culture Neutral.
            INFO: End assembly probing.
    ERROR: Cannot resolve reference Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053".
ERROR: Activation Context generation failed.
End Activation Context Generation.

=================
Begin Activation Context Generation.
Input Parameter:
    Flags = 0
    ProcessorArchitecture = x86
    CultureFallBacks = en-US;en
    ManifestPath = C:\Program Files\MyApp\InstallCustom.exe
    AssemblyDirectory = C:\Program Files\MyApp\
    Application Config File = 
-----------------
INFO: Parsing Manifest File C:\Program Files\MyApp\InstallCustom.exe.
    INFO: Manifest Definition Identity is (null).
    INFO: Reference: Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053"
INFO: Resolving reference Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053".
    INFO: Resolving reference for ProcessorArchitecture x86.
        INFO: Resolving reference for culture Neutral.
            INFO: Applying Binding Policy.
                INFO: Find publisher policy at C:\Windows\WinSxS\manifests\x86_policy.8.0.microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.1434_none_516c10c30f4aae68.manifest
                INFO: No binding policy redirect found.
            INFO: Begin assembly probing.
                INFO: Did not find the assembly in WinSxS.
                INFO: Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC80.CRT\8.0.50727.4053__1fc8b3b9a1e18e3b\Microsoft.VC80.CRT.DLL.
                INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT.DLL.
                INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT.MANIFEST.
                INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.DLL.
                INFO: Attempt to probe manifest at C:\Program Files\MyApp\Microsoft.VC80.CRT\Microsoft.VC80.CRT.MANIFEST.
                INFO: Did not find manifest for culture Neutral.
            INFO: End assembly probing.
    ERROR: Cannot resolve reference Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.4053".
ERROR: Activation Context generation failed.
End Activation Context Generation.

As you can see, it is failing to find Microsoft.VC80.CRT, the Visual C++ runtime dll.

The weird thing is that this runtime is already included in the installer, by adding the merge modules: "Microsoft_VC80_CRT_x86.msm" and "policy_8_0_microsoft_vc80_crt_x86.msm"

However, I suspect that these merge modules don't actually get applied until after this error is occurring…
But I have not been able to figure out how to include these needed files before the InstallCustom.exe runs. I've even tried copying the runtime over to the directory that file is in before the install.

Is there anyway to fix this issue? And why would this not be an issue on XP and 2000, but on Vista…I would think it should have this runtime.

Best Answer

You should use static version of the CRuntime (if possible), it is best practice that custom action will have as little as possible prerequisites. It will make the custom action a little bit bigger (in 10th of KB range) but it's worth it.


To compile using the static CRuntime library goto Project Properties\C/C++\Code Generation\Runtime Library. Don't forget that if your exe needs other dll that require that version of CRuntime they also need to compile use the static version.

Related Topic