无法在 windows 10 上构建 WIX 项目

Cannot build WIX project on windows 10

我的 WIX 安装程序项目在 windows 8.1 和 Visual Studio 2015 上成功构建。.NET 版本为 4.5.1。但是当我升级到 windows 10 时,我无法构建我的项目。

我不知道问题是因为 windows 10 还是其他原因。 当我构建我的项目时,我收到以下错误:

Error The "WixAssignCulture" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with in the project file, or in the *.tasks files located in the "C:\Program Files (x86)\MSBuild.0\bin" directory. ProSafeInstaller C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x\wix2010.targets 2340

Error The "ReadRegistry" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild..\WiX Toolset v3.8\bin\WixTasks.dll. Could not load file or assembly 'Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Не удается найти указанный файл. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. CustomActions.

WiX build 依赖于 NETFX v3.5。如果您在 "Programs and Features" 中启用“.NET Framework 3.5”功能,您应该能够构建您的 WiX 项目。

  1. 在控制面板中,打开程序和功能
  2. 点击打开或关闭 Windows 功能
  3. Select .NET Framework 3.5 并单击确定
  4. 等待功能安装,然后重建您的项目

Here 是关于 WiX 的相关错误报告。

在我的案例中 - VS2013 + Win10 + Wix Toolkit 3.9,我已经安装了 .NET 3.5 但错误发生了。然后我修改了 .wixproj 以添加以下变量 "WixInstallPath" 以指向 Wix 工具集的 bin 目录:

<PropertyGroup>
  ...
  <WixInstallPath>C:\Program Files\Wix Toolset v3.9\bin</WixInstallPath>
</PropertyGroup>

是的,这解决了我的问题。构建成功。