WiX Toolset: Creating a simple WiX project breaks in VS2017: The “CreateProjectReferenceDefineConstants” task was not found

谁说我不能喝 提交于 2019-12-01 10:57:12

问题


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

  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>

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

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 Studio\2017\Enterprise\MSBuild\15.0\Bin" 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.


回答1:


.NET Framework 3.5: After some debugging the solution was to install the .NET Framework 3.5.

  • WiX 3.x has a build-dependency requiring this version.
  • WiX 4.x requires .NET Core and Framework 4+.

Procedure:

  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.

Now you should be able to build your WiX projects.

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.


Links:

  • 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.


来源:https://stackoverflow.com/questions/54913177/wix-toolset-creating-a-simple-wix-project-breaks-in-vs2017-the-createprojectr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!