Tuesday, December 28, 2010

WiX 3.5 in Visual Studio 2010 undefined preprocessor variable when solution folders used

I ran into a problem with the WiX 3.5 installer in Visual Studio 2010 when trying to add a reference to a project in a solution folder. The folder structure looked like this:

  • Client
    • WiXProject
      • References
        • Common _Common\Common_
  • Common
    • Common
The installer built fine when I set Harvest to True, but, since I wanted more control over the installer, I wanted to manually edit the wxs file like this:

<file diskid="1" id="Common" name="$(var.Common.TargetFileName)" source="$(var.Common.TargetPath)">

Unfortunately, Votive (the WiX integration with Visual Studio) does not seem to correctly handle references to projects in solution folders. The workaround I used was to unload the WiX project and edit the line as highlighted:

    
      Common _Common\Common_
      {89f6f5f2-5aeb-4501-9f4f-9073d7dedd4c}
      True
      True
      Binaries;Content;Satellites
      INSTALLLOCATION
    

    
      Common
      {89f6f5f2-5aeb-4501-9f4f-9073d7dedd4c}
      True
      True
      Binaries;Content;Satellites
      INSTALLLOCATION
    

When I reloaded the project, my wxs file worked as originally configured because the variable var.Common.TargetFileName was now defined.

0 comments:

Post a Comment