WiX 工具集:在 VS2017 中创建简单的 WiX 项目中断:“CreateProjectReferenceDefineConstants"未找到任务 [英] WiX Toolset: Creating a simple WiX project breaks in VS2017: The "CreateProjectReferenceDefineConstants" task was not found

查看:24
本文介绍了WiX 工具集:在 VS2017 中创建简单的 WiX 项目中断:“CreateProjectReferenceDefineConstants"未找到任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用 Wix,并尝试为我的应用程序进行简单安装.我做了以下事情:

I'm new to using Wix, and tried to make a simple installation for my App. I did the following:

  1. 下载并安装了 Visual Studio 2017 扩展来自这里.
  2. 下载并安装WiX Toolset v3.11.1
  3. 为 WiX v3 创建了一个安装项目
  4. 在项目中添加了对我的App的引用,并在Product.wxs中添加了block:
  1. Downloaded and installed the Extension for Visual Studio 2017 from here.
  2. Download and installed WiX Toolset v3.11.1
  3. Created a Setup Project for WiX v3
  4. Added a reference to my App in the project, and added the block in Product.wxs:

<Component Id="ProductComponent">
  <File Source="$(var.MyApplication.TargetPath)" />
</Component>

当我编译 Wix 设置项目时,我收到以下错误:

When I compile the Wix setup project, I get the following error:

找不到CreateProjectReferenceDefineConstants"任务.查看如下: 1.) 项目文件中的任务名称是与任务类的名称相同.2.) 任务类是公共的"并且实现 Microsoft.Build.Framework.ITask 接口.3.) 任务在项目文件中或在*.tasks 文件位于C:Program Files (x86)Microsoft Visual Studio2017EnterpriseMSBuild15.0Bin"目录中.

The "CreateProjectReferenceDefineConstants" 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)Microsoft Visual Studio2017EnterpriseMSBuild15.0Bin" directory.

任何想法出了什么问题?我在网上找不到有关此错误的任何提及.什么是任务,什么是任务类?我期望做 这个快速指南 就足够简单了安装程序.

Any ideas what went wrong? I can't find any mention of this error online. Whatis a task and what is a task class? I was expecting that doing this quick guide would be enough for a simple installer.

推荐答案

.NET Framework 3.5:经过一些调试后,解决方案是安装 .NET Framework 3.5.

  • WiX 3.x 具有需要此版本的构建依赖项.
  • WiX 4.x 需要 .NET CoreFramework 4+.
  • WiX 3.x has a build-dependency requiring this version.
  • WiX 4.x requires .NET Core and Framework 4+.

程序:

  1. 按住 Windows 键点击 R.键入:appwiz.cpl 并按 Enter.
  2. 左窗格,单击打开/关闭 Windows 功能".
  3. 勾选/启用:.NET Framework 3.5".
  4. 运行 Windows 更新 (!) .如果你可以的话.检查安全更新.
    • 在 Windows 10 上:
      • 按住 Windows 键点击 R.
      • 键入:ms-settings:windowsupdate 并按 Enter.
      • 点击检查更新".
  1. Hold Windows Key and Tap R. Type: appwiz.cpl and press Enter.
  2. Left pane, click "Turn Windows Features On / Off".
  3. Tick / enable: ".NET Framework 3.5".
  4. Run Windows Update (!) . If you can. To check for security updates.
    • On Windows 10:
      • Hold Windows Key and Tap R.
      • Type: ms-settings:windowsupdate and press Enter.
      • Click "Check for updates".

现在您应该可以构建您的 WiX 项目了.

Now you should be able to build your WiX projects.

如果您处于托管环境中,也可以咨询技术支持.他们应该为这个 .NET 运行时准备一个现成的包,除非运行时本身被禁止使用.

Or talk to tech support if you are in a managed environment. They should have a ready-made package for this .NET runtime, unless the runtime itself is prohibited from use.

链接:

  • Cannot build WIX project on windows 10
  • Hello WiX - minimal step-by-step example for writing a WiX installer in Visual Studio.
  • Chris Painter's samples: https://github.com/iswix-llc/iswix-tutorials
  • WiX Quick Start. Further links to more samples.

这篇关于WiX 工具集:在 VS2017 中创建简单的 WiX 项目中断:“CreateProjectReferenceDefineConstants"未找到任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆