2011-12-14 181 views
1

我使用的是VS 2010 SP1,並且我已經創建了一個VS安裝項目來安裝我的應用程序。我的應用程序使用用C++編寫的DLL,因此我需要包含VC++ 2010運行時庫。Visual Studio 2010 SP1安裝項目不會安裝Visual C++ 2010運行時庫的SP1

我的一位用戶報告說,在運行我的安裝程序時出現錯誤,我將其追溯到事實上該用戶已安裝SP1版本的VC++ 2010運行時庫。我的安裝程序嘗試安裝非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安裝項目從微軟的SP1鏈接下載運行時庫(http://download.microsoft.com/download/C/6/D/C6D0FD4E-9E53-4897-9B91-836EBA2AACD3/vcredist_x86.exe)。我有點擔心,因爲這感覺像一個黑客。任何人有更好的想法?

如果它是有幫助的,這裏的安裝日誌從用戶誰打這個錯誤:在Visual Studio安裝項目

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' 

回答

0

預定義的先決條件是不是很好。他們很少更新的事實也是一個問題。

所以最好的解決方案是創建自己的自定義先決條件。 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

+0

'檢測標準'恰恰不起作用。有人的安裝程序首先到達該機器,並將msvcr100.dll複製到c:\ windows \ system32。因爲那很容易。 – 2011-12-15 09:29:54

0

我可以通過將我的C++ DLL的目標輸出添加到安裝項目中來解決這個問題。一旦我這樣做了,安裝項目會自動將適當的C++ dll與我的安裝程序捆綁在一起,現在一切正常。

最初的問題是由於我在安裝項目的先決條件中手動檢查了「C++運行時庫」。

@Cosmin Pirvu - 您的解決方案可能有效,但這是我最終做的。

相關問題