在Visual Studio 2012中,Visual C++缺少前置条件。

7
我最近安装了vs2012并更新了我的ClickOnce应用程序。更准确地说,第一次打开我依赖的主要C#项目的C++项目时,我没有更新它,一切正常。 VS 2012仍然能够看到Visual C++ 2010先决条件。后来,我通过在属性 -> 配置属性 -> 常规下将平台工具集更改为"Visual Studio 2012(v110)"来更新了我的项目。

与此同时,我安装了其他软件,现在我发现我无法再将Visual C++先决条件添加到我的ClickOnce发布项目中。 Visual C++ 2010 Runtime Libraries(x64)先决条件标有黄色三角形并且缺失。理想情况下,我想更新到Visual C++ 2012 Runtime Libraries x64(和x86),但即使缺少此先决条件。

我猜这是因为在文件夹C:\ Program Files(x86)\ Microsoft SDKs \ Windows \ v8.0A \ Bootstrapper \ Packages 中相应的包(vcredist_x64)为空。我还注意到,在控制面板中安装的程序列表中,我安装了Microsoft Visual C++ 2010 x64x86,分别是可再发行版本和运行时版本(我认为它们是先前与Visual Studio 2010一起安装的),而我缺少Visual C++ 2012文件。因此,我认为Visual C++ 2012没有与Visual Studio 2012一起提供,对吗?我甚至尝试通过下载Visual C++ 2012 Redistributable x64软件包并安装它们,现在它们列在我的已安装程序中(仅有可再发行版本,而没有运行时版本)。

然而,先决条件仍然缺失。我甚至考虑手动复制位于...\v7.0A\Bootstrapper\Packages文件夹中的Visual C++ 2010引导程序包,并将其手动更改为C++ 2012,但我不知道应该在<MsiProductCheck Property="VCRedistInstalled" Product=?>下的product.xml中写什么。似乎可以使用Bootstrapper Manager获取插入此信息的产品GUID,但此程序会抛出许多异常,我不知道该怎么做。作为第二个解决方案,从\\ v7.0A \ Bootstrapper \ Packages \ Bootstrapper \ Packages到v8.0A \ Bootstrapper \ Packages 简单复制Visual C++ 2010的包是否安全?

2个回答

3
请前往\v8.0A\Bootstrapper\Packages文件夹,确保您有vcredist_x86文件夹。
在该文件夹中,您应该有一个“en”文件夹,该文件夹应该保留在那里,您需要添加以下内容:
1. product.xml 2. vcredist_x86.exe 您可以从以下链接下载所需的.exe文件:http://go.microsoft.com/fwlink/?LinkID=266495&clcid=0x409 至于product.xml文件,则…
<?xml version="1.0" encoding="utf-8" ?> 

    <Product
      xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
      ProductCode="Microsoft.Visual.C++.11.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="{6C772996-BFF3-3C8C-860B-B3D48FF05D65}"/>
      </InstallChecks>

      <!-- Defines how to invoke the setup for the Visual C++ 11.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"/>
            <!-- 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>

谢谢,vcredist_x64.exe怎么样? - Berezh
1
Noam的回答是正确的,除了msbuild不喜欢两个“xml version ...”行的副本。我删除了一个,然后就可以在脚本上运行msbuild来制作安装文件了。 - David Reich

1

对于那些寻找2012 x64 vcredist类似答案的人,这是我拼凑出来的一个看起来有效的解决方案。请注意,下载链接为http://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe

<?xml version="1.0" encoding="utf-8" ?> 

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

  <!-- Defines list of files to be copied on build -->
  <PackageFiles>
    <PackageFile Name="vcredist_x64.exe" HomeSite="VCRedistExe"/>
  </PackageFiles>
  <InstallChecks>
    <MsiProductCheck Property="VCRedistInstalled" Product="{CF2BEA3C-26EA-32F8-AA9B-331F7E34BA97}"/>
  </InstallChecks>

  <!-- Defines how to invoke the setup for the Visual C++ 11.0 redist -->
  <!-- TODO: Needs EstimatedTempSpace, LogFile, and an update of EstimatedDiskSpace -->
  <Commands Reboot="Defer">
    <Command PackageFile="vcredist_x64.exe" 
         Arguments=' /q:a ' 
         >

      <!-- These checks determine whether the package is to be installed -->
      <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"/>

        <!-- Block install on any platform other than x64 -->
        <FailIf Property="ProcessorArchitecture" Value="AMD64" Compare="ValueNotEqualTo" String="InvalidOS"/>

        <!-- Block install on Vista or below -->
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="6.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>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接