如何为ClickOnce应用程序设置Windows Installer 4.5的引导程序包?

9

Publish 选项卡的 Prerequisites 中,我选择了 从与我的应用程序相同的位置下载先决条件 选项。

发布时出现错误,给了我以下指示:

要在先决条件对话框中启用“从与我的应用程序相同的位置下载先决条件”,必须将文件“WindowsInstaller4_5\Windows6.0-KB958655-v2-x86.MSU”下载到本地计算机。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkId=616018

该知识库文章说要打开 WindowsInstaller4_5 中的语言文件夹 (en) 中的 Package.xml 文件,然后

查找包含 http://go.microsoft.com/fwlink 的 Name 元素,并复制 URL。包括 LinkID 部分

但是 package.xml 文件中没有任何包含 http://go.microsoft.com/fwlink 的条目!其他引导程序文件夹的 package.xml 文件中都有这个条目,但没有 WindowsInstaller4_5

有人成功添加了 Windows Installer 4.5 包吗?你是怎么成功的?

我在 Windows 10 上使用 VS2015。

3个回答

5
我在Windows 7中使用VS2015时遇到了同样的问题。最终我找到了解决方案,即下载Windows Installer 4.5的安装包并将其复制到以下路径:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\SDK\Bootstrapper\Packages\WindowsInstaller4_5"。此后,设置项目编译成功。
需要注意的是,您需要复制所有版本的Windows Installer 4.5,如下图所示: enter image description here

4
除了操作系统(我在我的开发机上使用的是win 8.1),我的情况与你几乎相同。
你所遇到的问题听起来像是有人搞乱了你的product.xml文件。
以下是该文件的原始内容,它对我完美地起作用。
注意:
在编辑文件之前,请确保备份原始文件!
根目录-> C:\Program Files (x86)\Microsoft Visual Studio 14.0\SDK\Bootstrapper\Packages\WindowsInstaller4_5
文件内容
<?xml version="1.0" encoding="utf-8" ?>
<!-- Windows Installer 4.5 VS Bootstrapper : product.xml : Language neutral information -->
<Product
    xmlns="http://schemas.microsoft.com/developer/2004/01/bootstrapper"
    ProductCode="Microsoft.Windows.Installer.4.5">
  <!-- The package does not contain an IncludesProduct element for Windows Installer 3.1. -->
  <!-- This ommision is by design in order to achive a specific sequencing of bootstrapper packages -->
  <!-- to reduce the number of potential reboots under certain conditions. -->

  <!-- Defines list of files to be copied on build -->
  <PackageFiles CopyAllPackageFiles="false">
    <PackageFile Name="WindowsXP-KB942288-v3-x86.exe" HomeSite="Msi45XPx86exe"
                 PublicKey="3082010a0282010100a2db0a8dcfc2c1499bcdaa3a34ad23596bdb6cbe2122b794c8eaaebfc6d526c232118bbcda5d2cfb36561e152bae8f0ddd14a36e284c7f163f41ac8d40b146880dd98194ad9706d05744765ceaf1fc0ee27f74a333cb74e5efe361a17e03b745ffd53e12d5b0ca5e0dd07bf2b7130dfc606a2885758cb7adbc85e817b490bef516b6625ded11df3aee215b8baf8073c345e3958977609be7ad77c1378d33142f13db62c9ae1aa94f9867add420393071e08d6746e2c61cf40d5074412fe805246a216b49b092c4b239c742a56d5c184aab8fd78e833e780a47d8a4b28423c3e2f27b66b14a74bd26414b9c6114604e30c882f3d00b707cee554d77d2085576810203010001"/>
    <PackageFile Name="WindowsXP-KB958655-v2-x86-ENU.exe" HomeSite="Msi45UpdateXPx86exe"
                 PublicKey="3082010a0282010100a2db0a8dcfc2c1499bcdaa3a34ad23596bdb6cbe2122b794c8eaaebfc6d526c232118bbcda5d2cfb36561e152bae8f0ddd14a36e284c7f163f41ac8d40b146880dd98194ad9706d05744765ceaf1fc0ee27f74a333cb74e5efe361a17e03b745ffd53e12d5b0ca5e0dd07bf2b7130dfc606a2885758cb7adbc85e817b490bef516b6625ded11df3aee215b8baf8073c345e3958977609be7ad77c1378d33142f13db62c9ae1aa94f9867add420393071e08d6746e2c61cf40d5074412fe805246a216b49b092c4b239c742a56d5c184aab8fd78e833e780a47d8a4b28423c3e2f27b66b14a74bd26414b9c6114604e30c882f3d00b707cee554d77d2085576810203010001"/>
    <PackageFile Name="WindowsServer2003-KB942288-v4-x86.exe" HomeSite="Msi452K3x86exe"
                 PublicKey="3082010a0282010100a2db0a8dcfc2c1499bcdaa3a34ad23596bdb6cbe2122b794c8eaaebfc6d526c232118bbcda5d2cfb36561e152bae8f0ddd14a36e284c7f163f41ac8d40b146880dd98194ad9706d05744765ceaf1fc0ee27f74a333cb74e5efe361a17e03b745ffd53e12d5b0ca5e0dd07bf2b7130dfc606a2885758cb7adbc85e817b490bef516b6625ded11df3aee215b8baf8073c345e3958977609be7ad77c1378d33142f13db62c9ae1aa94f9867add420393071e08d6746e2c61cf40d5074412fe805246a216b49b092c4b239c742a56d5c184aab8fd78e833e780a47d8a4b28423c3e2f27b66b14a74bd26414b9c6114604e30c882f3d00b707cee554d77d2085576810203010001"/>
    <PackageFile Name="WindowsServer2003-KB958655-v2-x86-ENU.exe" HomeSite="Msi45Update2K3x86exe"
                 PublicKey="3082010a0282010100a2db0a8dcfc2c1499bcdaa3a34ad23596bdb6cbe2122b794c8eaaebfc6d526c232118bbcda5d2cfb36561e152bae8f0ddd14a36e284c7f163f41ac8d40b146880dd98194ad9706d05744765ceaf1fc0ee27f74a333cb74e5efe361a17e03b745ffd53e12d5b0ca5e0dd07bf2b7130dfc606a2885758cb7adbc85e817b490bef516b6625ded11df3aee215b8baf8073c345e3958977609be7ad77c1378d33142f13db62c9ae1aa94f9867add420393071e08d6746e2c61cf40d5074412fe805246a216b49b092c4b239c742a56d5c184aab8fd78e833e780a47d8a4b28423c3e2f27b66b14a74bd26414b9c6114604e30c882f3d00b707cee554d77d2085576810203010001"/>
    <PackageFile Name="WindowsServer2003-KB942288-v4-x64.exe" HomeSite="Msi45XP2K3x64exe"
                 PublicKey="3082010a0282010100a2db0a8dcfc2c1499bcdaa3a34ad23596bdb6cbe2122b794c8eaaebfc6d526c232118bbcda5d2cfb36561e152bae8f0ddd14a36e284c7f163f41ac8d40b146880dd98194ad9706d05744765ceaf1fc0ee27f74a333cb74e5efe361a17e03b745ffd53e12d5b0ca5e0dd07bf2b7130dfc606a2885758cb7adbc85e817b490bef516b6625ded11df3aee215b8baf8073c345e3958977609be7ad77c1378d33142f13db62c9ae1aa94f9867add420393071e08d6746e2c61cf40d5074412fe805246a216b49b092c4b239c742a56d5c184aab8fd78e833e780a47d8a4b28423c3e2f27b66b14a74bd26414b9c6114604e30c882f3d00b707cee554d77d2085576810203010001"/>
    <PackageFile Name="WindowsServer2003.WindowsXP-KB958655-v2-x64-ENU.exe" HomeSite="Msi45UpdateXP2K3x64exe"
                 PublicKey="3082010a0282010100a2db0a8dcfc2c1499bcdaa3a34ad23596bdb6cbe2122b794c8eaaebfc6d526c232118bbcda5d2cfb36561e152bae8f0ddd14a36e284c7f163f41ac8d40b146880dd98194ad9706d05744765ceaf1fc0ee27f74a333cb74e5efe361a17e03b745ffd53e12d5b0ca5e0dd07bf2b7130dfc606a2885758cb7adbc85e817b490bef516b6625ded11df3aee215b8baf8073c345e3958977609be7ad77c1378d33142f13db62c9ae1aa94f9867add420393071e08d6746e2c61cf40d5074412fe805246a216b49b092c4b239c742a56d5c184aab8fd78e833e780a47d8a4b28423c3e2f27b66b14a74bd26414b9c6114604e30c882f3d00b707cee554d77d2085576810203010001"/>
    <PackageFile Name="Windows6.0-KB958655-v2-x86.MSU" HomeSite="Msi45Vistax86msu"
                 PublicKey="3082010a0282010100bd3fd09234a458fda782a9fe41d4ba38708cf6307f3aa5780711ae2441263938cf7b39608fc5bf6b62cb70b5c933f3dd5de42ed7ba6739a4eeb784ee293a4e2e80d161e99a33b71a44d92ac78423059e42c50d77a92ac932bdd5cd4d47809ca376716519ff1e9eff947b20b1079ccd5d837469cd9ddf9504c24270fd8ad8db20f255c4f436c0c4f6a365b2dac139a35644f6e763149c4d43d952d2fbb44bb04d13f370289a7be16c27b9bfdfdd16905d60f8fe2744d9a4bc89d272c73fcd41cf8269926a511f43e5159294f0f5e471c6d90f4b79d04d832012590c9334205c629dd9e45c601a0cf9c802f7a184861d62847ae87cd6c6474fc7ed79837faa12f90203010001"/>
    <PackageFile Name="Windows6.0-KB958655-v2-x64.MSU" HomeSite="Msi45Vistax64msu"
                 PublicKey="3082010a0282010100bd3fd09234a458fda782a9fe41d4ba38708cf6307f3aa5780711ae2441263938cf7b39608fc5bf6b62cb70b5c933f3dd5de42ed7ba6739a4eeb784ee293a4e2e80d161e99a33b71a44d92ac78423059e42c50d77a92ac932bdd5cd4d47809ca376716519ff1e9eff947b20b1079ccd5d837469cd9ddf9504c24270fd8ad8db20f255c4f436c0c4f6a365b2dac139a35644f6e763149c4d43d952d2fbb44bb04d13f370289a7be16c27b9bfdfdd16905d60f8fe2744d9a4bc89d272c73fcd41cf8269926a511f43e5159294f0f5e471c6d90f4b79d04d832012590c9334205c629dd9e45c601a0cf9c802f7a184861d62847ae87cd6c6474fc7ed79837faa12f90203010001"/>
  </PackageFiles>

  <InstallChecks>
    <FileCheck Property="VersionMsiDll" FileName="msi.dll" SearchPath="System32" SpecialFolder="WindowsFolder" />
  </InstallChecks>
  <!-- Defines how to invoke the setup for the Windows installer 4.5 redist -->
  <Commands Reboot="Immediate">
    <!-- Defines installation command for:
                  Windows XP Service Pack 2 and later
                  on x86 platform -->
    <Command PackageFile="WindowsXP-KB942288-v3-x86.exe"
             Arguments= "/quiet /norestart"
             EstimatedInstalledBytes="3327000"
             EstimatedInstallSeconds="120" >
      <InstallConditions>
        <BypassIf Property="VersionMsi" Compare="VersionGreaterThanOrEqualTo" Value="4.5" />
        <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" />
        <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="5.2.0" />
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform"/>
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.1.2" String="InvalidPlatform"/>
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <!-- Defer reboot until MSI 4.5 update below -->
        <ExitCode Value="1641" Result="Success"/>
        <ExitCode Value="3010" Result="Success"/>
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>

    <Command PackageFile="WindowsXP-KB958655-v2-x86-ENU.exe"
             Arguments= "/quiet /norestart"
             EstimatedInstalledBytes="1506160"
             EstimatedInstallSeconds="120" >
      <InstallConditions>
        <BypassIf Property="VersionMsiDll" Compare="VersionGreaterThanOrEqualTo" Value="4.5.6001.22299" />
        <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" />
        <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="5.2.0" />
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform"/>
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.1.2" String="InvalidPlatform"/>
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <ExitCode Value="1641" Result="SuccessReboot"/>
        <ExitCode Value="3010" Result="SuccessReboot"/>
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>

    <!-- Defines installation command for:
                  Windows 2003 Service Pack 1 or later
                  on x86 platform -->
    <Command PackageFile="WindowsServer2003-KB942288-v4-x86.exe"
             Arguments= "/quiet /norestart"
             EstimatedInstalledBytes="3071512"
             EstimatedInstallSeconds="120" >
      <InstallConditions>
        <BypassIf Property="VersionMsi" Compare="VersionGreaterThanOrEqualTo" Value="4.5" />
        <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" />
        <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="5.2.0"/>
        <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="6.0"/>
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform"/>
        <FailIf Property="VersionNT" Compare="VersionEqualTo" Value="5.2.0" String="InvalidPlatform"/>
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <!-- Defer reboot until MSI 4.5 update below -->
        <ExitCode Value="1641" Result="Success"/>
        <ExitCode Value="3010" Result="Success"/>
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>

    <Command PackageFile="WindowsServer2003-KB958655-v2-x86-ENU.exe"
             Arguments= "/quiet /norestart"
             EstimatedInstalledBytes="1502584"
             EstimatedInstallSeconds="120" >
      <InstallConditions>
        <BypassIf Property="VersionMsiDll" Compare="VersionGreaterThanOrEqualTo" Value="4.5.6001.22299" />
        <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" />
        <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="5.2.0"/>
        <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="6.0"/>
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform"/>
        <FailIf Property="VersionNT" Compare="VersionEqualTo" Value="5.2.0" String="InvalidPlatform"/>
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <ExitCode Value="1641" Result="SuccessReboot"/>
        <ExitCode Value="3010" Result="SuccessReboot"/>
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>

    <!-- Defines installation command for:
                  Windows XP Service Pack 2 and later
                  Windows 2003 Service Pack 1 or later
                  on x64 platform -->
    <Command PackageFile="WindowsServer2003-KB942288-v4-x64.exe"
             Arguments= "/quiet /norestart"
             EstimatedInstalledBytes="4691480"
             EstimatedInstallSeconds="120" >
      <InstallConditions>
        <BypassIf Property="VersionMsi" Compare="VersionGreaterThanOrEqualTo" Value="4.5" />
        <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64" />
        <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="6.0"/>
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform"/>
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.1.2" String="InvalidPlatform"/>
        <FailIf Property="VersionNT" Compare="VersionEqualTo" Value="5.2.0" String="InvalidPlatform"/>
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <!-- Defer reboot until MSI 4.5 update below -->
        <ExitCode Value="1641" Result="Success"/>
        <ExitCode Value="3010" Result="Success"/>
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>

    <Command PackageFile="WindowsServer2003.WindowsXP-KB958655-v2-x64-ENU.exe"
             Arguments= "/quiet /norestart"
             EstimatedInstalledBytes="2904952"
             EstimatedInstallSeconds="120" >
      <InstallConditions>
        <BypassIf Property="VersionMsiDll" Compare="VersionGreaterThanOrEqualTo" Value="4.5.6001.22299" />
        <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64" />
        <BypassIf Property="VersionNT" Compare="VersionGreaterThanOrEqualTo" Value="6.0"/>
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform"/>
        <FailIf Property="VersionNT" Compare="VersionLessThan" Value="5.1.2" String="InvalidPlatform"/>
        <FailIf Property="VersionNT" Compare="VersionEqualTo" Value="5.2.0" String="InvalidPlatform"/>
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <ExitCode Value="1641" Result="SuccessReboot"/>
        <ExitCode Value="3010" Result="SuccessReboot"/>
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>

    <!-- Defines installation command for:
                  Vista RTM and later
                  Windows Server 2008 RTM and later
                  on x86 platform -->
    <Command PackageFile="Windows6.0-KB958655-v2-x86.MSU"
             Arguments= "/quiet /norestart"
             EstimatedInstalledBytes="1960465"
             EstimatedInstallSeconds="120" >
      <InstallConditions>
        <BypassIf Property="VersionMsiDll" Compare="VersionGreaterThanOrEqualTo" Value="4.5.6001.22308" />
        <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="Intel" />
        <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="6.0" />
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform"/>
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <ExitCode Value="1641" Result="SuccessReboot"/>
        <ExitCode Value="3010" Result="SuccessReboot"/>
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>

    <!-- Defines installation command for:
                  Vista RTM and later
                  Windows Server 2008 RTM and later
                  on x64 platform -->
    <Command PackageFile="Windows6.0-KB958655-v2-x64.MSU"
             Arguments= "/quiet /norestart"
             EstimatedInstalledBytes="3342348"
             EstimatedInstallSeconds="120" >
      <InstallConditions>
        <BypassIf Property="VersionMsiDll" Compare="VersionGreaterThanOrEqualTo" Value="4.5.6001.22308" />
        <BypassIf Property="ProcessorArchitecture" Compare="ValueNotEqualTo" Value="amd64" />
        <BypassIf Property="VersionNT" Compare="VersionLessThan" Value="6.0" />
        <FailIf Property="Version9x" Compare="ValueExists" String="InvalidPlatform"/>
        <FailIf Property="AdminUser" Compare="ValueEqualTo" Value="false" String="AdminRequired"/>
      </InstallConditions>
      <ExitCodes>
        <ExitCode Value="0" Result="Success"/>
        <ExitCode Value="1641" Result="SuccessReboot"/>
        <ExitCode Value="3010" Result="SuccessReboot"/>
        <DefaultExitCode Result="Fail" FormatMessageFromSystem="true" String="GeneralFailure" />
      </ExitCodes>
    </Command>
  </Commands>

  <!-- Defines Homesite locations for each of the downloads -->
  <Strings>
    <String Name="Msi45XPx86exe">http://go.microsoft.com/fwlink/?LinkID=118633</String>
    <String Name="Msi45UpdateXPx86exe">http://go.microsoft.com/fwlink/?LinkID=161053</String>
    <String Name="Msi452K3x86exe">http://go.microsoft.com/fwlink/?LinkID=119115</String>
    <String Name="Msi45Update2K3x86exe">http://go.microsoft.com/fwlink/?LinkID=161054</String>
    <String Name="Msi45XP2K3x64exe">http://go.microsoft.com/fwlink/?LinkID=118636</String>
    <String Name="Msi45UpdateXP2K3x64exe">http://go.microsoft.com/fwlink/?LinkID=161055</String>
    <String Name="Msi45Vistax86msu">http://go.microsoft.com/fwlink/?LinkID=161056</String>
    <String Name="Msi45Vistax64msu">http://go.microsoft.com/fwlink/?LinkID=161057</String>
  </Strings>
</Product>

2
在链接的MSDN文章中明确提到:

如果没有任何Name元素包含http://go.microsoft.com/fwlink,请在先决条件的根文件夹中打开Product.xml文件并找到fwlink字符串。该字符串位于文件底部。请注意,您收到的消息有点误导人,您需要下载共计八个安装程序到您的计算机上。用户实际使用哪一个取决于他的Windows版本。

我强烈建议您不要这样做。对于用户来说,无论他从Microsoft服务器还是从您的服务器下载安装程序都没有任何区别。除了一个细节问题,如果他确实需要该安装程序,则他没有通过Windows Update保持计算机更新。现在这种情况非常少见,但如果您遇到这样的用户,他将会是...(委婉地说)让您非常头疼的人。他会期望您提供支持,因为是您的机器提供了该安装程序。而且必须如此,因为他无法得到Microsoft的支持。事实上,您也无法提供这样的支持,因为您不知道计算机的状态。

正如您所说,强烈建议勾选“从组件供应商的网站下载先决条件”。但是,“从与我的应用程序相同的位置下载先决条件”选项适用于断开连接的环境。 - mggSoft
哦,我真的不知道任何人如何在断开连接的计算机上获取ClickOnce发布URL。 - Hans Passant
不使用 ClickOnce - mggSoft

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