Thursday, 12 February 2009

Fighting WIX Merge Module

This one caused me some pain…. imagine if you are trying to use Wix3 to create a nice merge module for a C++ application in VS2005. Chances are you are going to end up with this error

Error 7 Undefined preprocessor variable '$(var.MyProject.TargetFileName)'

if you have a wxs that looks something like this :

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Module Id="TestMergeModule" Language="1033" Version="1.0.0.0">
    <Package Id="ef2a568e-a8db-4213-a211-9261c26031aa" Manufacturer="Me" InstallerVersion="200" />
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="MergeRedirectFolder">
        <Component Id="MyProject" Guid="{1081C5BC-106E-4b89-B14F-FFA71B0987E1}">
          <File Id="Test" Name="$(var.MyProject.TargetFileName)" Source="$(var.MyProject.TargetPath)" DiskId="1" />
        </Component>
      </Directory>
    </Directory>
  </Module>
</Wix>

After much fighting and time wasting I found that this is known bug and there is a request in to fix it, you can see details here on StackOverflow.

No comments:

Post a Comment