Sweet! That write-up was extremely useful! Steps 1-3 gave me the context I 
needed. Thank you so very much! I was probably being dense.

The value passed in from tfsbuild.proj was getting overridden by the definition 
in the *.wixproj which is why you got the results you got in 3). In MSBuild the 
last definition of a property always wins. What you want to do is concatenate 
the current value of DefineConstants (as specified in tfsbuild.proj) with the 
default values you specify in *.wixproj.

Ok, here's what you want to do:

In tfsbuild.proj specify your DefineConstants like you were already doing:

<SolutionToBuild 
Include="$(BuildProjectFolderPath)/../../LBA/Source/AllProject/AllProject.sln">
    <Targets></Targets>
    <Properties>
        DefineConstants=BG_STANDARD;
        OutDir=$(TeamBuildOutDir)BG_STANDARD\
    </Properties>
</SolutionToBuild>
<SolutionToBuild 
Include="$(BuildProjectFolderPath)/../../LBA/Source/AllProject/AllProject.sln">
    <Targets></Targets>
    <Properties>
        DefineConstants=BG_PROFESSIONAL;
        OutDir=$(TeamBuildOutDir)BG_PROFESSIONAL\
    </Properties>
</SolutionToBuild>

In your *.wixproj define DefaultDefineConstants (in the first PropertyGroup). 
It should include your values for WiXProductName and WiXProductVersion. Also 
define DefineConstants (in the first PropertyGroup) twice using a Condition 
attribute to check whether DefineConstants already had a value.

<PropertyGroup>
    <!-- other properties -->
    <DefaultDefineConstants>WiXProductName=BeamGage 
Standard;WiXProductVersion=$(WiXVersion)</DefaultDefineConstants>
    <DefineConstants Condition=" '$(DefineConstants)' == '' 
">$(DefaultDefineConstants)</DefineConstants>
    <DefineConstants Condition=" '$(DefineConstants)' != '' 
">$(DefineConstants);$(DefaultDefineConstants)</DefineConstants>
</PropertyGroup>

When $(DefineConstants) is not set then we set the new value of DefineConstants 
to the value of DefaultDefineConstants.
When $(DefineConstants) is set (value provided by tfsbuild.proj) then we set 
the new value of DefineConstants to include both the old value of 
DefineConstants and the value of DefaultDefineConstants.

At this point we have the correct value of DefineConstants defined for 
Release|x86 so we don't need to define it in the PropertyGroup for Release|x86.
We still need to add Debug for Debug|x86 so we'll define DefineConstants in the 
PropertyGroup for Debug|x86 to include Debug and the current value of 
DefineConstants.

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
    <DefineConstants>Debug;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>

This all happens statically when the project files are loaded into memory.

The syntax that uses <CreateProperty/> is a task that creates properties 
dynamically at runtime and must be specified inside the body of a Target. In 
this case, we have all the information we need to create the correct values at 
load time so we don't need to wait until runtime to define DefineConstants.

Hopefully that now explains what was going on. Or at least, get you unblocked 
so that you can build again. :)

Edwin G. Castro
Software Developer - Staff
Electronic Banking Services
Fiserv
Office: 503-746-0643
Fax: 503-617-0291
www.fiserv.com
Please consider the environment before printing this e-mail

> -----Original Message-----
> From: Kurt Jensen [mailto:kurt.jen...@ophir-spiricon.com]
> Sent: Thursday, May 20, 2010 10:06 AM
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] msbuild command line parameters
> 
> Not odd.  Well, maybe I don't understand the oddness.
> 
> 1)
> - I created a new WindowsFormsApplication1.
> - I added a new WixProject1.
> - On the WixProject1, right-click Properties.  On the Build tab, entered
> "Name1=Value1;Name2;Name3=Name3"
> - From the command line, "msbuild /fl WindowsFormsApplication1.sln"
> - msbuild.log correctly shows "-dName1=Value" "-dName2" "-dName3=Value3" on
> the command line to candle
> 
> 2)
> - Copied a default TFSBuild.proj.  Changed the SolutionToBuild to
> WindowsFormsApplication1.sln
> - From the command line, "msbuild /fl TFSBuild.proj"
> - msbuild.log correctly shows "-dName1=Value" "-dName2" "-dName3=Value3" on
> the command line to candle
> 
> 3)
> - Under SolutionToBuild, Properties, added "DefineConstants=BG_STANDARD"
> - From the command line, "msbuild /fl TFSBuild.proj"
> - msbuild.log shows "-dBG_STANDARD" but does NOT include "-dName1=Value1", etc
> - AH HA!!!
> 
> 4)
> - Removed "DefineConstants=BG_STANDARD"
> - Added
>   <Target Name="BeforeBuild">
>     <CreateProperty Value="BGProductName=BeamGage
> Professional;$(DefineConstants)">
>       <Output TaskParameter="Value" PropertyName="DefineConstants" />
>     </CreateProperty>
>   </Target>
> - From the command line, "msbuild /fl TFSBuild.proj"
> - msbuild.log shows "-dName1=Value", etc but does not show "-
> dBGProductName=BeamGage Professional"
> 
> 5)
> - Changed CreateProperty line to <CreateProperty
> Value="BGProductName;$(DefineConstants)">
> - From the command line, "msbuild /fl TFSBuild.proj"
> - msbuild.log shows "-dName1=Value", etc but does not show "-dBGProductName"
> 
> 
> And so, the question returns...  Any idea how to get parameters passed to
> candle when building under TFSBuild.proj?

------------------------------------------------------------------------------

_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to