Visual c++ 指定VC++;ClickOnce先决条件的可再发行版本 我的CLICKONE应用程序使用第三方工具,需要Visual C++ 2005可重新分发。如果只安装了VC++2008可再发行版本,第三方工具将无法工作。但是,在VisualStudio2008中,ClickOnce先决条件不允许为VC++可再发行文件指定版本;它将添加一个VC++2008的先决条件,这在大多数情况下是有意义的。但是,在这种情况下,需要更早的版本。ClickOnce是必需的,所以合并模块是不可能的。关于如何指定版本有什么想法吗?

Visual c++ 指定VC++;ClickOnce先决条件的可再发行版本 我的CLICKONE应用程序使用第三方工具,需要Visual C++ 2005可重新分发。如果只安装了VC++2008可再发行版本,第三方工具将无法工作。但是,在VisualStudio2008中,ClickOnce先决条件不允许为VC++可再发行文件指定版本;它将添加一个VC++2008的先决条件,这在大多数情况下是有意义的。但是,在这种情况下,需要更早的版本。ClickOnce是必需的,所以合并模块是不可能的。关于如何指定版本有什么想法吗?,visual-c++,clickonce,versions,redistributable,prerequisites,Visual C++,Clickonce,Versions,Redistributable,Prerequisites,我相信您可以打开应用程序的清单文件,并修改应用程序应该链接的redists的版本。清单中的列表应与C:\Windows\WinSxS目录中的列表相匹配。有一个例子很好地描述了如何使用不同的可再发行文件。如果你能找到一台安装了VS2005的机器,解决方案应该不会太难。您可以自定义在项目的“发布”选项卡上的“前提条件”对话框中显示的内容 在安装了VS 2005的计算机上,转到\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\

我相信您可以打开应用程序的清单文件,并修改应用程序应该链接的redists的版本。清单中的列表应与C:\Windows\WinSxS目录中的列表相匹配。有一个例子很好地描述了如何使用不同的可再发行文件。

如果你能找到一台安装了VS2005的机器,解决方案应该不会太难。您可以自定义在项目的“发布”选项卡上的“前提条件”对话框中显示的内容

  • 在安装了VS 2005的计算机上,转到\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages并将vsredist\u x86文件夹复制到您要发布的计算机上
  • 重命名该文件夹,将其命名为vsredist
    \uucode>x86
    \ucode>2005或类似名称
  • 在文件夹中,编辑\en\package.xml文件。将<强>代码> <代码> <强>标签转换为有意义的东西(<强> Visual C++ 2005运行时库(x86)< /强>),以区别它与现有的2008包。
  • 将文件夹复制到C:\Program Files\Microsoft SDK\Windows\v6.0A\Bootstrapper\Packages
  • 如果Visual Studio已打开,请重新启动它

  • 现在,当您打开“先决条件”对话框时,您应该会看到2005包的一个新条目。我没有完全测试此解决方案,因此可能遗漏了一些细节,但希望您能从中开始。

    我刚刚安装了Visual Studio 2005。这是一个原始的引导程序:

    C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist\U x86\

    \en\package.xml

    <?xml version="1.0" encoding="utf-8" ?>
    
    <Package
      xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
      Name="DisplayName"
      Culture="Culture"
    >
    
        <!-- Defines a localizable string table for error messages-->
        <Strings>
            <String Name="DisplayName">Visual C++ Runtime Libraries (x86)</String>
            <String Name="Culture">en</String>
            <String Name="AdminRequired">You do not have the permissions required to install Visual C++ Runtime Libraries (x86). Please contact your administrator.</String>
            <String Name="InvalidPlatformWin9x">Installation of Visual C++ Runtime Libraries (x86) is not supported on Windows 95. Contact your application vendor.</String>
            <String Name="InvalidPlatformWinNT">Installation of Visual C++ 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++ Runtime Libraries (x86).</String>
        </Strings>
    
    </Package>
    

    这是真的;但是,它不会影响已安装的先决条件。即使清单指定了2005年的redists,ClickOnce安装程序也只会安装2008年的redists,这使得依赖关系仍然无法解决
    <?xml version="1.0" encoding="utf-8" ?> 
    
    <Product
      xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
      ProductCode="Microsoft.Visual.C++.8.0.x86"
    >
    
      <!-- Defines list of files to be copied on build -->
      <PackageFiles>
        <PackageFile Name="vcredist_x86.exe"/>
      </PackageFiles>
    
      <InstallChecks>
        <MsiProductCheck Property="VCRedistInstalled" Product="{A49F249F-0C91-497F-86DF-B2585E8E76B7}"/>
      </InstallChecks>
    
      <!-- Defines how to invoke the setup for the Visual C++ 8.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>
    
    SHA1: 95040f80b0d203e1abaec4e06e0ec0e01c507d03