[wix-users] User Defined variable used in BeforeBuild

Phill Hogland phill.hogland at rimage.com
Thu Nov 5 10:26:15 PST 2015


I do not think that is possible because <?define ProductTitle = "My Product Title"?> is a WiX preprocessor construct which is evaluated by candle.exe.  The syntax is unknown to MSBuild, and at the time that MSBuild processes BeforeBuild it has not called candle.exe to do the preprocessing.  However I do the reverse, keeping my original initialization in the wixproj file (or a .target file which is imported into the .wixproj).  For situations where I put the info into a .target file, I may (or may not), add that file to my VS Project with the Build Action set to 'None'.  However if I ever edit the .targets file I must close the VS Solution and reload it for the change to be imported.

1) I define my product name (and other parameters as MSBuild properties in my .wixproj file (or an 'imported' .targets file.
<MyBundleName>Company Product Name</MyBundleName>
2) Use CompilerAdditionalOptions (I put it in a PropertyGroup after all of the Property Group '$(Configuration)|$(Platform)' blocks), which defines a pre-processor variable (like would do in wxi file) with the MSBuild property, in the .wxxproj file (or a .targets file). 
    <CompilerAdditionalOptions>
      $(CompilerAdditionalOptions)
...
      -dMyBundleNameBldProp="$(MyBundleName)"
...
    </CompilerAdditionalOptions>
3) In the wxs file I use the pre-processor variable using the $(varMyBundleNameBldProp) syntax.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Brian Enderle
Sent: Thursday, November 05, 2015 12:03 PM
To: WiX Users <wix-users at lists.wixtoolset.org>
Subject: [wix-users] User Defined variable used in BeforeBuild

I would like to use a variable I am defining in my Product.wxs:

<?define ProductTitle = "My Product Title"?>

in a BeforeBuild action:

<!-- Update Assembly.cs for this product -->
    <AssemblyInfo AssemblyProduct=$(var.ProductTitle) />

Obviously this doesn't work.


Is there a way I can use a User Defined Variable from my Product.wxs file in the BeforeBuild?

The reason for this is we develop numerous products using the same base C# project.  I create different WiX installers which contain different SQL files used by the different products.  When I build the WiX product I would like to update the base product so the version number matches the product.

I have seen many examples of updating the WiX version number using the C# project info but this is exactly opposite of that and I have not found any info on doing this.



Brian

If you can't explain it simply, you don't understand it well enough.  - Albert Einstein

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/


More information about the wix-users mailing list