0

I have been referencing the following tutorial for creating a Setup Project for WiX v3, however, most WiX tutorials on the internet are targeting a C# application as its base project. I am currently building a Visual C++17 Win32 application that I want to deploy (i.e. create a setup *.msi installer) using WiX, given how powerful WiX is.

Unfortunately, adding a reference to my C++ project yields a yellow bang exclamation point: enter image description here

Moreover, when trying to reference an icon file, for example, in the Product.wxs file using $(var.TimeTrack.ProjectDir)\TimeTrack.ico reports that it is an "undefined predecessor variable." I have tried unloading the WiX Setup Project and tried validating that the yellow banged Visual C++ project reference is referring to the correct path in the *.wixproj file. The include path appears to be correct:

<ItemGroup>
    <ProjectReference Include="..\TimeTrack\TimeTrack.vcxproj">
    <Name>TimeTrack</Name>

    <!-- More not shown. -->
</ItemGroup>

I did a bit of digging and I cam across this StackOverflow posting that indicated that WiX is dependent on .NET framework. In addition, there seems to be a lot of very old postings (e.g. example 1) on this topic and I just am not entirely sure if I am just misunderstanding something here. According to this post, the WiX project cannot refer to any C/C++ code, but this appears to be referring to "Custom Actions," which appear to be an entirely different topic (?).

All in all, am I doing something wrong or is WiX not capable of deploying C++ applications? Is WiX only meant for deploying C# applications?

Ðаn
  • 10,934
  • 11
  • 59
  • 95
Code Doggo
  • 2,146
  • 6
  • 33
  • 58

1 Answers1

0

WiX has a development dependency on .NET but not an install time dependency.

Files are files. WiX doesn't care if they are C, C++, VB, PowerBuilder, Delphi, .NET, NodeJS, Electron or whatever.

The main differences for .NET vs C/C++ is:

1) .NET typically requires you to check that .NET is installed or author a bootstrapper to install it.

2) .NET core can typically be packaged with the app privately without a system wide installation of .NET core.

3) C/C++ typically requires installing the VCRedist via a bootstrapper or statically linking the files into your application.

4) .NET is "AnyCPU" where as C/C++ is compiled for the platform. MSI is compiled for the platoform. This means for .NET a single x86 MSI can deploy a .NET app that might run 32bit or 64bit depending on how it was built. For C/C++ you might need to create a 32bit MSI and a 64bit MSI for your app.

I have a FOSS tool that helps with learning and authoring WiX. You can read about it here:

http://www.github.com/iswix-llc/iswix-tutorials

The tutorials only hav C# examples but pull requests are welcome. Create your C/C++ application and use a postbuild copy command to stage the files to the Installer\Deploy folder and everything else is mostly the same.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • I appreciate the insight here. I think my only question I have is, **how do you add a C++ project reference without a yellow exclamation mark?** If you create a new Win32 app (`File->New->Project->Installed->Visual C++->Widows Desktop->Windows Desktop Application`) and then try and add this as a reference to your WiX proejct, a yellow exclamation mark **always** shows up. What's going on? – Code Doggo Feb 19 '20 at 02:17
  • There is nothing that says you have to use project references in WiX projects. Specifically I prefer not to. Take a look at my tutorials to see another way. – Christopher Painter Feb 19 '20 at 19:49
  • I just copy files to an output location with other means and use [preprocessor constructs](https://stackoverflow.com/a/49501700/129130) to allow source path override ([WiX preprocessor documentation](https://wixtoolset.org/documentation/manual/v3/overview/preprocessor.html)). [Here is one example](https://stackoverflow.com/a/54766353/129130) - [direct source file link](https://github.com/glytzhkof/all/blob/master/CompilerVariables.wxs). – Stein Åsmul Feb 19 '20 at 21:25