1
votes

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
Not 100% sure, maybe try to follow the step-by-step description here for compiling an MSI using WiX (maybe the inline comments at the bottom code section are fastest). Just replace the absolute path with your variable. I think the key is that those variables are only available once you have a reference set to something WiX - such as the GUI dll. Try it out?Stein Åsmul
I just followed the Minimal WiX MSI Compile - Step-By-Step from the link, but the error is still there, I feel like something went wrong with the installation of the extension or the toolset, not sure :/ I wonder if the toolset version has to be a different one? PS. The error is still the same, except this time it says: The "ResolveWixReferences" task... <<the rest of the error text is the same>>gbdavid
Yeah, I didn't read that thoroughly. Thought I'd just see if a hint could work. Maybe you have an MSBuild problem? Do you have another machine to test on? (just checking). And the obvious restart of the tool and reboot maybe? Will have a quick look later.Stein Åsmul
Maybe check this. Build dependency on DotNET 3.5?Stein Åsmul
I don't like using project references like that for about a dozen reasons. If you are new to WiX and creating a simple installer I suggest starting with github.com/iswix-llc/iswix-tutorialsChristopher Painter

1 Answers

2
votes

.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.
    • On Windows 10:
      • Hold Windows Key and Tap R.
      • Type: ms-settings:windowsupdate and press Enter.
      • Click "Check for 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: