I'm attempting to build an installer using WiX 4. I've installed Heatwave and Visual Studio 2022, created a WiX project and added my target solution as a reference. I was able to build in the IDE by right clicking on the WiX project and selecting build. However, I'm unable to get the same output by using the command line.
When I run through the IDE by right clicking and choosing "Build" or "Rebuild" this creates an installer in the bin\x64\Release\en-US folder, and the msi package has a platform of x64
in the Summary Information stream.
However, if I try running:
dotnet build "MySetup" -c Release
where MySetup
is the folder my wixproj is located in, the installer is created but is placed under the bin\Release\en-US folder (note that there is no reference of x64 in the path) and the resulting msi has a platform of Intel
in the Summary Information stream. If I try running:
dotnet build "MySetup" -c Release -a x64
Then the build complains because my dependent project doesn't have a target for win-x64. Which seems to be beside the point, as Visual Studio was clearly able to build it.
How can I figure out what command line Visual Studio is using here? Apologies if this is obvious, I'm new to both WiX 4 and Visual Studio 2022.
Building in Visual Studio builds the .sln file and takes into account the Build Configuration found in the toolbar under Build > Configuration Manager. The .sln will set the platform specifically for each project, including whether to build x86, x64, or arm64.
Building with dotnet build
will build the project in the directory you specify. You don't provide enough detail, but I'm guessing "MySetup" is a directory containing your .wixproj. So, you are directly building the .wixproj without the Build Configuration context from the .sln file. Thus, when you tell dotnet build
to explicitly build x64, it does so for the .wixproj and all the projects it references.
I happened to hit exactly this sort of issue in my last Deployment Dojo episode. It isn't the episode's topic, but the Configuration Manager is used to fix the build and shows the more advanced configuration available in .wixprojs.