我使用VS2005为我正在开发的应用程序创建了一个安装项目,它在Windows 2000和XP上安装得很好,但是当我尝试在Vista上运行安装程序时,它会出现以下错误:
此Windows存在问题 安装程序包。需要一个程序 为此安装完成不了 跑了。
此错误发生在安装过程的最后,在它已将所有文件复制到磁盘之后,并且在尝试运行我的自定义操作可执行文件时发生。
自定义操作二进制文件是一个名为InstallCustom.exe的文件,用C ++编写。它是非常基本的,只处理安装,提交,卸载和回滚操作,除了设置一些注册表项并激活几个批处理脚本以完成安装之外,别无其他。
我在安装过程中运行了SXSTrace以查看它失败的原因并获得以下跟踪:
=================
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.
正如您所看到的,它无法找到Microsoft.VC80.CRT,即Visual C ++运行时DLL。
奇怪的是,通过添加合并模块,此运行时已包含在安装程序中:“Microsoft_VC80_CRT_x86.msm”和“policy_8_0_microsoft_vc80_crt_x86.msm”
但是,我怀疑这些合并模块实际上并没有应用,直到发生此错误... ... 但是,在运行InstallCustom.exe之前,我无法弄清楚如何包含这些所需的文件。我甚至尝试将运行时复制到安装之前文件所在的目录。
有没有解决这个问题?为什么这个不在XP和2000上是一个问题,但在Vista上......我认为应该有这个运行时。
答案 0 :(得分:1)
您应该使用CRuntime的静态版本(如果可能),最佳做法是自定义操作将具有尽可能少的先决条件。它会使自定义动作更大一些(在KB范围的第10个范围内),但这是值得的。
使用静态CRuntime库goto Project Properties\C/C++\Code Generation\Runtime Library
进行编译。
不要忘记,如果你的exe需要其他需要该版本CRuntime的dll,他们还需要编译使用静态版本。