[wix-users] Unable to correctly specify a variable for WiX within Visual Studio

Phill Hogland phill.hogland at rimage.com
Wed Mar 9 11:24:33 PST 2016


HeatDirectory goes in the .wixproj file (or in a .Targets file that is improted into a .wixproj), generally after the PropertyGroup(s) related to selecting Configurations and before the first ItemGroup.  HeatDirectory is a MSBuild 'Target' defined by the wix build process.  There are many advantages over calling heat on the command line in my view.  The output wxs files are automatically added to the compiler's file list, and I don't have to do anything to manage whether the files are out of date and need to be rebuilt.  I used to call heat with a batch file, using the WiX define targets and Tasks is a much better approach.  As for the the VS pre-Build those are VS specific.  VS uses MSBuild to build a project and WiX integrates with MSBuild (and with VS projects).  Personally I avoid the VS specific Targets and us default MSBuild or WiX targets, which allows me to do a lot of build process customization and integration.  

________________________________________
From: wix-users <wix-users-bounces at lists.wixtoolset.org> on behalf of Jon Earle <earlej at hotmail.com>
Sent: Wednesday, March 9, 2016 1:12 PM
To: WiX Toolset Users Mailing List
Subject: Re: [wix-users] Unable to correctly specify a variable for WiX within Visual Studio

The HeatDirectory section goes into the wixproj or into the product.wxs file (guessing the former)?
What is the advantage (or disadantage) of that vs just putting the commandlines into the pre-build event?
Cheers!Jon

> From: Jacob.Hoover at greenheck.com
> To: wix-users at lists.wixtoolset.org
> Date: Wed, 9 Mar 2016 18:01:08 +0000
> Subject: Re: [wix-users] Unable to correctly specify a variable for WiX within Visual Studio
>
> 1) *.wixproj's are just XML files (MSBuild) - Votive is an ugly beast, so I don't think we have a means of doing it today without cracking open the project.
> 2) That was just an example usage of MSBuild properties, passed to a DefineConstant, then consumed by the Wix Compielr/Linker.  <Bundle> is the main starting point for a burn bundle, but it could just as easily been a Package element (for a MSI).
> 3)
>
>   <PropertyGroup>
>     <!-- The following props are needed to build the bundle based off of a local Wix build -->
>     <WixToolPath>...\wix3\build\debug\x86\</WixToolPath>
>     <WixTargetsPath>$(WixToolPath)Wix.targets</WixTargetsPath>
>     <WixTasksPath>$(WixToolPath)wixtasks.dll</WixTasksPath>
>     <WixExtDir>$(WixToolPath)</WixExtDir>
>     <!-- End local wix build props -->
>   </PropertyGroup>
>
> <UsingTask TaskName="HeatDirectory" AssemblyFile="$(WixTasksPath)" />
>
> <Target Name="Build">
>   ...
>   <HeatDirectory NoLogo="true" ToolPath="$(WixToolPath)" VerboseOutput="true" AutogenerateGuids="true"
>      GenerateGuidsNow="false" OutputFile="$(IntermediateOutputPath)Foo.wxs"
>      SuppressFragments="true" Directory="$(SomeDirToHarvest)\Data\" ComponentGroupName="MyComponents"
>      DirectoryRefId="CommonData" PreprocessorVariable="var.SourceDataFolder" SuppressCom="true" SuppressRootDirectory="true" SuppressRegistry="true" />
>
>
>
> -----Original Message-----
> From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Jon Earle
> Sent: Wednesday, March 09, 2016 9:25 AM
> To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> Subject: Re: [wix-users] Unable to correctly specify a variable for WiX within Visual Studio
>
> Thank you for responding to my inquiry.
> 1. How do I create the <JavaDocBase> property from the project properties page? All I see when I shell out to the commandline and view the wixproj file is the <DefineConstants> property.  Trying to do all this via the gui as much as possible because there will be others who will eventually maintain this and I want to make it as simple as possible.
> 2. Where does the <Bundle> property enter the picture?  It's not mentioned in any of my files...
> 3. HeatDirectoryTask... why did I not use it?  Many reasons: a) did not know about it b) don't know how to use it (including, where to put it) c) I am reading a lot of what appears to be conflicting or incorrect or incomplete information on the 'Net and trying to gain a working understanding out of it all.
> Cheers!Jon
>
>
>
> > From: Jacob.Hoover at greenheck.com
> > To: wix-users at lists.wixtoolset.org
> > Date: Tue, 8 Mar 2016 20:48:19 +0000
> > Subject: Re: [wix-users] Unable to correctly specify a variable for WiX within      Visual Studio
> >
> > <PropertyGroup>
> >   <JavaDocBase>c:\javadocs</JavaDocBase>
> > <DefineConstants>
> >       $(DefineConstants);
> >       VersionMajorMinor=$(VersionMajorMinor);
> >       VersionBuild=$(VersionBuild);
> >       VersionQFE=$(VersionQFE);
> >       BundleUpgradeCode=$(BundleUpgradeCode);
> >       JavaDocBase=$(JavaDocBase);
> > </DefineConstants>
> > </PropertyGroup>
> >
> > Should work if you are referring to them in your WXS via
> >
> > <Bundle Version="$(var.VersionMajorMinor).$(var.VersionBuild).$(var.VersionQFE)"
> >           UpgradeCode="$(var.BundleUpgradeCode)"
> > ...
> >
> > If you have a PreBuild event, use the MSBuild property instead of the var syntax.
> >
> > <PreBuildEvent>"$(WIX)bin\heat.exe" dir "$(JavaDocBase)" -cg JavaDocs_JSP -gg -scom -sreg -sfrag -srd -dr INSTALLDIR -var var.JavaDocBase -out "$(ProjectDir)\JavaDocs_JSP_Fragment.wxs"</PreBuildEvent>
> >
> >
> > I am a bit confused why you opted not to use the HeatDirectoryTask.
> >
> > -----Original Message-----
> > From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Jon Earle
> > Sent: Tuesday, March 08, 2016 1:15 PM
> > To: wix-users at lists.wixtoolset.org
> > Subject: [wix-users] Unable to correctly specify a variable for WiX within Visual Studio
> >
> > Setup is Wix 3.10.2 and visual studio 2015. Working with a wix setup project and custom action project.
> > I want to create a fragment containing the javados for my project. I had read (http://weblogs.sqlteam.com/mladenp/archive/2010/02/11/WiX-3-Tutorial-SolutionProject-structure-and-Dev-resources.aspx) to set a pre-processor variable (or system variable). I opted to include the variable definition in the project. I tried the pre-processor var <DefineConstants>JavaDocBase=c:\javadocs</DefineConstants>
> > and just setting a normal variable:
> > <WixVariables>JavaDocBase=c:\javadocs</WixVariables>
> > Neither ended up working.
> > Pre-Build event:
> > <PropertyGroup><PreBuildEvent>"$(WIX)bin\heat.exe" dir "$(var.JavaDocBase)" -cg JavaDocs_JSP -gg -scom -sreg -sfrag -srd -dr INSTALLDIR -var var.JavaDocBase -out "$(ProjectDir)\JavaDocs_JSP_Fragment.wxs"</PreBuildEvent></PropertyGroup>
> > I always seem to receive the error:
> > Unhandled Exception:The expression """.JavaDocBase" cannot be evaluated. Method 'System.String.JavaDocBase' not found.
> > I have tried var.JavaDocBase, wix.JavaDocBase, env.JavaDocBase and Just JavaDocBase... while the last will allow the command to run, it doesn't put in the proper path so I am no further ahead.
> > Is it possible to replicate what is in that previously linked tutorial and if so, what have I done wrong?
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
> >
> > ____________________________________________________________________
> > WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/


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



More information about the wix-users mailing list