簡體   English   中英

Visual Studio先決條件將安裝已安裝的程序包

[英]Visual Studio Prerequisites installs already installed packages

我使用的是VS 2015,Visual Studio 2012不需要Visual C ++可再發行組件。因此,我創建了一個自定義引導程序,並將其存儲在VS引導文件夾中。

package.xml

<Package
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  Name="DisplayName"
  Culture="Culture"
>
    <Strings>
        <String Name="DisplayName">Visual C++ 2012 Runtime Libraries (x86)</String>
        <String Name="Culture">en</String>
        <String Name="AdminRequired">You do not have the permissions required to install Visual C++ 2012 Runtime Libraries (x86). Please contact your administrator.</String>
        <String Name="InvalidPlatformWin9x">Installation of Visual C++ 2012 Runtime Libraries (x86) is not supported on Windows 95. Contact your application vendor.</String>
        <String Name="InvalidPlatformWinNT">Installation of Visual C++ 2012 Runtime Libraries (x86) is not supported on Windows NT 4.0. Contact your application vendor.</String>
        <String Name="GeneralFailure">A failure occurred attempting to install Visual C++ 2012 Runtime Libraries (x86).</String>
        <String Name="VCRedistExe">https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe</String>

    </Strings>
</Package>

這是product.xml

<?xml version="1.0" encoding="utf-8" ?> 
<Product
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  ProductCode="Microsoft.Visual.C++.12.0.x86"
>
  <PackageFiles>
    <PackageFile Name="vcredist_x86.exe" HomeSite="VCRedistExe" PublicKey="3082010a0282010100e8af5ca2200df8287cbc057b7fadeeeb76ac28533f3adb407db38e33e6573fa551153454a5cfb48ba93fa837e12d50ed35164eef4d7adb137688b02cf0595ca9ebe1d72975e41b85279bf3f82d9e41362b0b40fbbe3bbab95c759316524bca33c537b0f3eb7ea8f541155c08651d2137f02cba220b10b1109d772285847c4fb91b90b0f5a3fe8bf40c9a4ea0f5c90a21e2aae3013647fd2f826a8103f5a935dc94579dfb4bd40e82db388f12fee3d67a748864e162c4252e2aae9d181f0e1eb6c2af24b40e50bcde1c935c49a679b5b6dbcef9707b280184b82a29cfbfa90505e1e00f714dfdad5c238329ebc7c54ac8e82784d37ec6430b950005b14f6571c50203010001" />
  </PackageFiles>

  <InstallChecks>
    <MsiProductCheck Property="VCRedistInstalled" Product="{6C772996-BFF3-3C8C-860B-B3D48FF05D65} "/>
  </InstallChecks>

  <Commands Reboot="Defer">
    <Command PackageFile="vcredist_x86.exe" 
         Arguments=' /q:a ' 
         >

      <InstallConditions>
        <BypassIf Property="VCRedistInstalled" Compare="ValueGreaterThanOrEqualTo" Value="3"/>
        <!-- Block install if user does not have admin privileges -->
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
      </InstallConditions>

      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <ExitCode Value="3010" Result="SuccessReboot"/>
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>

    </Command>
  </Commands>
</Product>

該安裝程序下載並安裝了Visual Studio 2012的Visual c ++可再發行組件。但是問題是,即使安裝了它,我也再次運行安裝程序,再次下載並嘗試安裝C ++重新發行版。 我認為問題出在product.xml。 有什么辦法解決這個問題?

經過少量研究,我發現“ Visual C ++ 2012運行時庫(x86)”的版本為11.0,而不是您提到的12.0。 在您的product.xml中嘗試以下操作:

<Product
  xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
  ProductCode="Microsoft.Visual.C++.11.0.x86"
>

或者,如果仍然無法解決,請查看此答案: Visual Studio 2012中缺少Visual C ++的先決條件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM