Search code examples
.netwix.net-4.7.2

Where is WixTargetsImported set? "The WiX Toolset v3.11 build tools must be installed to build this project."


When I create a Merge Module with WiX, the wixproj file has

 <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
  <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
    <Error Text="The WiX Toolset v3.11 build tools must be installed to build this project. To download the WiX Toolset, see https://wixtoolset.org/releases/v3.11/stable" />
  </Target>

at the end. I did an echo and this is what I get back

  WixTargetsPath: 
  MSBuildExtensionsPath32: C:\Program Files\dotnet\sdk\9.0.101
  WixTargetsImported: 

So I get The WiX Toolset v3.11 build tools must be installed to build this project. To download the WiX Toolset, see https://wixtoolset.org/releases/v3.11/stable, but I installed WiX 3.14 and the WiX v3 Visual Studio 2022 extension.

The errors only occur during dotnet-commands (clean, build, restore). But not when I do a Visual Studio Build/Rebuild Solution.


Solution

  • WiX v3 does not support the modern build requirements of dotnet commands. WiX v3 was designed in 2009, well before any of that stuff was dreamed up. :)

    You need to move to WiX v4+ and it's modern Sdk-style targets, which fully support dotnet build.