After doing more digging, it looks like my previous experience is a result of behavior specific to VSDPROJ’s (and possibly InstallShield), wheras WiX is conforming to the Windows Installer.
As I discovered at this link, TARGETDIR
is actually supposed to represent the root of the drive with the most free space available (assuming there’s more than one). That’s why WiX projects have directories nested under there for Program Files, etc. Visual Studio actually adds a custom action that overrides this property to the full installation path.
I was able to accomplish what I wanted by doing two things:
- Change all of my components and component groups to install to
TARGETDIR
instead ofINSTALLFOLDER
(the default directory that WiX put in there) - Add a custom action that sets the value of the
TARGETDIR
property to the installation path, assuming one wasn’t passed in from the command line.
To do that, I added this under the <Product>
tag:
<CustomAction Id="SetTARGETDIR" Property="TARGETDIR"
Value="[ProgramFilesFolder][Manufacturer]\[ProductName]"
Execute="firstSequence" />
And this within the <InstallExecuteSequence>
tag:
<Custom Action="SetTARGETDIR" Before="CostFinalize">TARGETDIR=""</Custom>