Visual Studio 2010 SP1 安装项目不安装 Visual C++ 2010 运行时库的 SP1
Posted
技术标签:
【中文标题】Visual Studio 2010 SP1 安装项目不安装 Visual C++ 2010 运行时库的 SP1【英文标题】:Visual Studio 2010 SP1 setup project doesn't install SP1 of Visual C++ 2010 Runtime Libraries 【发布时间】:2011-12-14 16:59:05 【问题描述】:我正在使用 VS 2010 SP1,并且我创建了一个 VS 安装项目来安装我的应用程序。我的应用程序使用用 C++ 编写的 DLL,因此我需要包含 VC++ 2010 运行时库。
我的一个用户报告说在运行我的安装程序时出错,我追查到这个用户已经安装了 VC++ 2010 运行时库的 SP1 版本。我的安装程序尝试安装非 SP1 版本,然后在看到已安装较新版本(SP1 版本)时退出。
我已经确认这是问题的根源:http://social.microsoft.com/Forums/en/crm/thread/db84d4c3-c58e-4ff9-997f-f4e0116bf043 和 http://notepad.patheticcockroach.com/1666/installing-visual-c-2010-and-windows-sdk-for-windows-7-offline-installer-and-installation-troubleshooting/
似乎用户唯一的解决方法是卸载 SP1 运行时库,然后运行我的安装程序。显然这并不理想,所以我正在寻找更好的解决方案。
我想出的唯一方法是告诉我的 VS 安装项目从 Microsoft 的 SP1 链接 (http://download.microsoft.com/download/C/6/D/C6D0FD4E-9E53-4897-9B91-836EBA2AACD3/vcredist_x86.exe) 下载运行时库。我有点担心,因为这感觉就像一个黑客。谁有更好的主意?
如果有帮助,这里是遇到此错误的用户的安装日志:
The following properties have been set:
Property: [AdminUser] = true boolean
Property: [InstallMode] = HomeSite string
Property: [ProcessorArchitecture] = AMD64 string
Property: [VersionNT] = 6.1.1 version
Running checks for package 'Windows Installer 3.1', phase BuildList
The following properties have been set for package 'Windows Installer 3.1':
Running checks for command 'WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe'
Result of running operator 'VersionGreaterThanOrEqualTo' on property 'VersionMsi' and value '3.1': true
Result of checks for command 'WindowsInstaller3_1\WindowsInstaller-KB893803-v2-x86.exe' is 'Bypass'
'Windows Installer 3.1' RunCheck result: No Install Needed
Running checks for package 'Visual C++ 2010 Runtime Libraries (x86)', phase BuildList
Running MsiProductCheck with ProductCode '196BB40D-1578-3D01-B289-BEFC77A11A1E'
MsiQueryProductState returned '-1'
Setting value '-1 int' for property 'VCRedistInstalled'
The following properties have been set for package 'Visual C++ 2010 Runtime Libraries (x86)':
Property: [VCRedistInstalled] = -1 int
Running checks for command 'vcredist_x86\vcredist_x86.exe'
Result of running operator 'ValueGreaterThanEqualTo' on property 'VCRedistInstalled' and value '3': false
Result of running operator 'ValueEqualTo' on property 'AdminUser' and value 'false': false
Skipping FailIf because Property 'Version9X' was not defined
Result of running operator 'VersionLessThan' on property 'VersionNT' and value '5.00': false
Result of checks for command 'vcredist_x86\vcredist_x86.exe' is 'Install'
'Visual C++ 2010 Runtime Libraries (x86)' RunCheck result: Install Needed
Running checks for package 'Microsoft .NET Framework 4 Client Profile (x86 and x64)', phase BuildList
Reading value 'Version' of registry key 'HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Client'
Read string value '4.0.30319'
Setting value '4.0.30319 string' for property 'DotNet40Client_TargetVersion'
The following properties have been set for package 'Microsoft .NET Framework 4 Client Profile (x86 and x64)':
Property: [DotNet40Client_TargetVersion] = 4.0.30319 string
Running checks for command 'DotNetFX40Client\dotNetFx40_Client_x86_x64.exe'
Result of running operator 'ValueEqualTo' on property 'InstallMode' and value 'HomeSite': true
Result of checks for command 'DotNetFX40Client\dotNetFx40_Client_x86_x64.exe' is 'Bypass'
Running checks for command 'DotNetFX40Client\dotNetFx40_Client_setup.exe'
Result of running operator 'ValueNotEqualTo' on property 'InstallMode' and value 'HomeSite': false
Result of running operator 'VersionGreaterThanOrEqualTo' on property 'DotNet40Client_TargetVersion' and value '4.0.30129': true
Result of checks for command 'DotNetFX40Client\dotNetFx40_Client_setup.exe' is 'Bypass'
'Microsoft .NET Framework 4 Client Profile (x86 and x64)' RunCheck result: No Install Needed
Installation of components 'Visual C++ 2010 Runtime Libraries (x86)' was accepted.
Copying files to temporary directory "C:\Users\JAGDISH\AppData\Local\Temp\VSD653B.tmp\"
Downloading files to "C:\Users\JAGDISH\AppData\Local\Temp\VSD653B.tmp\"
(14-12-2011 14:03:32) Downloading 'vcredist_x86\vcredist_x86.exe' from 'http://go.microsoft.com/fwlink/?LinkID=177916&clcid=0x409' to 'C:\Users\JAGDISH\AppData\Local\Temp\VSD653B.tmp\'
Download completed at 14-12-2011 14:05:00
Verifying file integrity of C:\Users\JAGDISH\AppData\Local\Temp\VSD653B.tmp\vcredist_x86\vcredist_x86.exe
WinVerifyTrust returned 0
File trusted
Running checks for package 'Visual C++ 2010 Runtime Libraries (x86)', phase BeforePackage
Running MsiProductCheck with ProductCode '196BB40D-1578-3D01-B289-BEFC77A11A1E'
MsiQueryProductState returned '-1'
Setting value '-1 int' for property 'VCRedistInstalled'
The following properties have been set for package 'Visual C++ 2010 Runtime Libraries (x86)':
Property: [VCRedistInstalled] = -1 int
Running checks for command 'vcredist_x86\vcredist_x86.exe'
Result of running operator 'ValueGreaterThanEqualTo' on property 'VCRedistInstalled' and value '3': false
Result of running operator 'ValueEqualTo' on property 'AdminUser' and value 'false': false
Skipping FailIf because Property 'Version9X' was not defined
Result of running operator 'VersionLessThan' on property 'VersionNT' and value '5.00': false
Result of checks for command 'vcredist_x86\vcredist_x86.exe' is 'Install'
'Visual C++ 2010 Runtime Libraries (x86)' RunCheck result: Install Needed
Verifying file integrity of C:\Users\JAGDISH\AppData\Local\Temp\VSD653B.tmp\vcredist_x86\vcredist_x86.exe
WinVerifyTrust returned 0
File trusted
Installing using command 'C:\Users\JAGDISH\AppData\Local\Temp\VSD653B.tmp\vcredist_x86\vcredist_x86.exe' and parameters ' /q:a '
Process exited with code 5100
Status of package 'Visual C++ 2010 Runtime Libraries (x86)' after install is 'InstallFailed'
【问题讨论】:
【参考方案1】:Visual Studio 安装项目中的预定义先决条件不是很好。它们很少更新的事实也是一个问题。
因此,最好的解决方案是创建您自己的自定义先决条件。 Visual Studio 安装项目不支持自定义先决条件创建。但是,可以通过手动生成required manifests来完成。
这些清单可以使用Bootstrapper Manifest Generator tool 自动生成。
生成包清单后,您可以将所有这些文件(包括包)添加到 Visual Studio 必备文件夹中的单独文件夹中,例如:
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages
这样您可以在设置项目属性页面中选择先决条件。
您的自定义先决条件可以检测原始运行时和 SP1。您可以在此处找到 SP1 检测标准:http://blogs.msdn.com/b/astebner/archive/2010/05/05/10008146.aspx
【讨论】:
“检测标准”正是不起作用的。某人的安装程序首先到达那台机器,然后将 msvcr100.dll 复制到 c:\windows\system32。因为这很容易。【参考方案2】:我能够通过将我的 c++ DLL 的目标输出添加到安装项目来解决这个问题。完成此操作后,安装项目会自动将适当的 c++ dll 与我的安装程序捆绑在一起,现在一切正常。
最初的问题是因为我在安装项目的先决条件中手动检查了“C++ 运行时库”。
@Cosmin Pirvu -- 你的解决方案可能有效,但这是我最终要做的。
【讨论】:
以上是关于Visual Studio 2010 SP1 安装项目不安装 Visual C++ 2010 运行时库的 SP1的主要内容,如果未能解决你的问题,请参考以下文章
安装 Visual Studio 2010 SP1 后有没有办法释放空间
Visual Studio 2010 SP1 可以安全安装吗?Assembly 签名到底是啥?
Visual Studio 2010 SP1 上的 ASP.NET 代码分析