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

How can I set up the bootstrapper package for Windows Installer 4.5 for a ClickOnce application?

Publish 选项卡的 Prerequisites 中,我选择了 Download prerequisites from the same location as my application 选项。

我在发布时遇到错误,它给了我以下指示:

To enable 'Download prerequisites from the same location as my application' in the Prerequisites dialog box, you must download file 'WindowsInstaller4_5\Windows6.0-KB958655-v2-x86.MSU' for item 'Windows Installer 4.5' to your local machine. For more information, see http://go.microsoft.com/fwlink/?LinkId=616018

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

Locate the Name element that contains http://go.microsoft.com/fwlink, and copy the URL. Include the LinkID portion

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

中没有

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

我在 Windows 10.

上使用 VS2015

除了 OS(我在我的开发机器上运行 win 8.1),我和你有几乎相同的情况。

您的问题听起来像是(某人)弄乱了您的 product.xml 文件。

下面是该文件的原始内容,对我来说非常有用。

备注

Before you edit the file, make sure you back up the original one!

Rootfolder -> 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>

我在 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 的所有版本,如图所示:

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

Note

If no Name element contains http://go.microsoft.com/fwlink, open the Product.xml file in the root folder for the prerequisite and locate the fwlink string.

在文件底部。请注意,您收到的消息有点误导,您必须将总共 个安装程序下载到您的计算机上。用户实际使用哪一个取决于他的 Windows 版本。

我强烈建议您不要这样做。对于用户来说,无论他是从 Microsoft 服务器还是从您的服务器下载安装程序都没有任何区别。除了一个棘手的细节外,如果他确实 需要 安装程序,那么他就不会使用 Windows 更新来更新他的机器。

现在这不太可能了,谢天谢地,但如果你遇到这样的用户,那么他会,我该怎么说呢……,你屁股的一大痛点。他会希望 在部署此安装程序时出现任何问题时提供支持,因为它是你的机器提供的。也必然如此,他得不到微软的支持。实际上你也无法提供这样的支持,你不知道机器是什么形状。