在未安装Visual C++ 2005 的算计机上行运应用 Visual C++ 2005发开的应用序程,必须先安装Visual C++2005 行运刻时库组件。Visual C++ 2005 SP1更新了这个组件,所以应用Visual C++2005 SP1 发开的应用序程必须随序程布发Visual C++ 2005 SP1行运刻时库组件。但是Visual C++ 2005 SP1的一个BUG成造应用安装和部署项目停止部署的时候,安装序程可能安装原版的Visual C++2005 行运刻时库组件,而不是SP1版本,成造应用Visual C++2005 SP1 发开的应用序程启动失败。这个问题的原因是%Program Files%Microsoft Visual Studio8\SDK\v2.0\BootStrapper\Packages\vcredist_x86上面的product.xml中的产品代码在安装Visual C++ 2005 SP1的程过中没有更新。要正修这个问题,可以打开这个文件,修改如下两行
<MsiProductCheck Property="VCRedistInstalled" Product="{A49F249F-0C91-497F-86DF-B2585E8E76B7}"/>
和
<BypassIf Property="VCRedistInstalled" Compare="ValueGreaterThanOrEqualTo" Value="3"/>
为
<MsiProductCheck Property="VCRedistInstalled" Product="{7299052b-02a4-4627-81f2-1818da5d550d}"/>
和
<BypassIf Property="VCRedistInstalled" Compare="ValueGreaterThanOrEqualTo" Value="5"/>
改后的product.xml文件如下
<?xml version="1.0" encoding="utf-8" ?> <Product xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper" ProductCode="Microsoft.Visual.C++.10.0.x86" > <!-- Defines list of files to be copied on build --> <PackageFiles> <PackageFile Name="vcredist_x86.exe" HomeSite="VCRedistExe"/> <!--补丁--> </PackageFiles> <InstallChecks> <MsiProductCheck Property="VCRedistInstalled" Product="{7299052b-02a4-4627-81f2-1818da5d550d}"/> <!-- <MsiProductCheck Property="VCRedistInstalled" Product="{196BB40D-1578-3D01-B289-BEFC77A11A1E}"/> --> </InstallChecks> <!-- Defines how to invoke the setup for the Visual C++ 10.0 redist --> <!-- TODO: Needs EstrimatedTempSpace, LogFile, and an update of EstimatedDiskSpace --> <Commands Reboot="Defer"> <Command PackageFile="vcredist_x86.exe" Arguments=' /q:a ' > <!-- These checks determine whether the package is to be installed --> <InstallConditions> <!-- <BypassIf Property="VCRedistInstalled" Compare="ValueGreaterThanOrEqualTo" Value="3"/>--> <BypassIf Property="VCRedistInstalled" Compare="ValueGreaterThanOrEqualTo" Value="5"/> <!-- Block install if user does not have admin privileges --> <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/> <!-- Block install on Win95 --> <FailIf Property="Version9X" Compare="VersionLessThan" Value="4.10" String="InvalidPlatformWin9x"/> <!-- Block install on NT 4 or less --> <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.00" String="InvalidPlatformWinNT"/> </InstallConditions> <ExitCodes> <ExitCode Value="0" Result="Success"/> <ExitCode Value="3010" Result="SuccessReboot"/> <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" /> </ExitCodes> </Command> </Commands> </Product>
另外,Visual C++ 2005 SP1版本的可以用最新的Visual C++ 2005 SP1行运刻时库组件来替换%Program Files%Microsoft Visual Studio8\SDK\v2.0\BootStrapper\Packages\vcredist_x86上面的vcredist_x86.exe,这样安装和部署项目生产的安装序程中会含包最新版的组件。