Visual Studio 2010 SP1安装项目不安装Visual C ++ 2010运行时库的SP1

时间:2011-12-14 16:59:05

标签: visual-studio visual-studio-2010 visual-c++ setup-project

我正在使用VS 2010 SP1,我已经创建了一个VS安装项目来安装我的应用程序。我的应用程序使用用C ++编写的DLL,因此我需要包含VC ++ 2010运行时库。

我的一位用户报告在运行我的安装程序时遇到错误,我追溯到这个用户已经安装了VC ++ 2010运行时库的SP1版本。我的安装程序尝试安装非SP1版本,然后在看到已安装的新版本(SP1版本)时退出。 screenshot of error screenshot of error

我已经确认这是问题的根源:http://social.microsoft.com/Forums/en/crm/thread/db84d4c3-c58e-4ff9-997f-f4e0116bf043http://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'

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

我能够通过将我的c ++ DLL的目标输出添加到安装项目来解决这个问题。一旦我这样做,安装项目自动将适当的c ++ dll与我的安装程序捆绑在一起,现在一切运行正常。

最初的问题是由于我在安装项目的先决条件中手动检查了“C ++运行时库”这一事实。

@Cosmin Pirvu - 您的解决方案可能有效,但这就是我最终要做的事情。