在 Visual Studio 2017 年设置项目

Setup project in Visual Studio 2017

我已经将使用 VS 2010 在 .Net 2.0 中开发的 windows 服务迁移到 VS 2017 上的 .Net 4.7.2。有一个安装项目迁移失败,因为 VS 2017 不支持此项目类型.正如微软建议的那样 here 我正在使用 wix 创建安装项目,并按此顺序下载并安装了 wix 工具集 3.11.1、Visual Studio 2017 的 Wix 扩展和 wix VS Designer,并按照教程创建了该集上项目。但我收到了错误 Could not load file or assembly 'wix, Version=4.0.0.0, Culture=neutral, PublicKeyToken=c9acf360d0e036e3' or one of its dependencies.

wix 目标文件具有以下代码:

<PropertyGroup>
    <WixTargetsImported>true</WixTargetsImported>

    <!-- MSBuild 4.0 -->
    <!-- MSBuild does not do short circuit evaluation of the AND operator, so we cannot have
         something like '$(MSBuildToolsVersion)' != '' AND '$(MSBuildToolsVersion)' &gt;= '4.0'
         instead set as default and override -->
    <WixVersionTargetsPath>wix2010.targets</WixVersionTargetsPath>
    <!-- MSBuild 2.0 - 3.5 -->
    <WixVersionTargetsPath Condition=" '$(MSBuildToolsVersion)' == '' OR '$(MSBuildToolsVersion)' &lt; '4.0' ">wix200x.targets</WixVersionTargetsPath>
  </PropertyGroup>

由于 MSBuildToolsVersion 是 15,它应该选择正确的目标文件 wix2010.targets。查看此文件,$(WixInstallPath) 从 $(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Installer XML.11@InstallRoot) 读取其值。现在我没有这个路径(路径中没有 Windows Installer XML)。 我不太了解 wix 工具集。在我看来,安装没有正确完成,尽管我在安装过程中没有收到任何错误。从那时起,我已经卸载并重新安装了 VS 2017 的 wix 工具集和扩展,但没有成功。有没有其他人在 VS 2017 中完成迁移并使用 wix 工具集来创建安装项目并遇到这个问题?

仅使用安装程序项目加载项并迁移现有安装项目可能更容易。它在市场上:

https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.MicrosoftVisualStudio2017InstallerProjects

您发布的 link 确实提到了这些,所以也许您已经决定使用 WiX。