Here's a snippet of what you want to do:

  <!-- Embed Version target into the build process -->
  <PropertyGroup>
    Version;
    $(CoreBuildDependsOn)
  </PropertyGroup>
  <!--Get Subversion Revision here-you must use MSBUILDCommunityTasks:-->
  <Target Name="Version" >
    <SvnVersion ToolPath="$(Subversion)" LocalPath="..\">
      <Output TaskParameter="Revision" PropertyName="Revision"/>
    </SvnVersion>
    <Message Text="Version: $(Revision)" Importance="high"/>
    <!-- MSBuild 3.5 Syntax -->
    <PropertyGroup>
      <!-- If DefineConstants is not defined -->
      <DefineConstants Condition="'$(DefineConstants)' == 
''">SubversionRevision=$(Revision)</DefineConstants>
      <!-- If DefineConstants is defined -->
      <DefineConstants Condition="'$(DefineConstants)' != 
''">$(DefineConstants);SubversionRevision=$(Revision)</DefineConstants>
    </PropertyGroup>
    <!-- MSBuild 2.0 Syntax -->
      <!-- If DefineConstants is not defined -->
    <CreateProperty Condition="'$(DefineConstants)' == ''" 
Value="SubversionRevision=$(Revision)">
      <Output TaskParameter="Value" PropertyName="DefineConstants"/>
    </CreateProperty>
      <!-- If DefineConstants is defined -->
    <CreateProperty Condition="'$(DefineConstants)' != ''" 
Value="$(DefineConstants);SubversionRevision=$(Revision)">
      <Output TaskParameter="Value" PropertyName="DefineConstants"/>
    </CreateProperty>
  </Target>

You don't need both the MSBuild 2.0 and 3.5 syntaxes. I use Visual Studio 2008 
so I use MSBuild 3.5 syntax. Technically, the <!-- If DefineConstants is not 
defined --> portions are not necessary because you always define 
DefineConstants at the project scope. Here's how I would rewrite your entire 
project:

<Project DefaultTargets="Build" 
xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>
  <!--Main Property group-->
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == ''">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <ProductVersion>1.0</ProductVersion>
    <ProjectGuid>{1bc4cf27-badd-47e0-87a7-9e3ed0c8c50b}</ProjectGuid>
    <SchemaVersion>2.0</SchemaVersion>
    <OutputName>Wix_TagImport</OutputName>
    <OutputType>Package</OutputType>
    <WixToolPath>..\..\DLL\Wix\</WixToolPath>
    <Subversion>..\..\DLL\CollabNet Subversion Client</Subversion>
    
<MSBUILDCommunityTasks>..\..\DLL\MSBuildCommunityTasks\</MSBUILDCommunityTasks>
    <WixTasksPath>$(WixToolPath)\wixtasks.dll</WixTasksPath>
    <WixTargetsPath>$(WixToolPath)\Wix.targets</WixTargetsPath>
    <Cultures>en-us</Cultures>
    <LinkerBaseInputPaths>..\MYAPP\bin\Release</LinkerBaseInputPaths>
  </PropertyGroup>
  <Import Project="$(WixToolPath)\Wix.targets" />
  <Import Project="$(MSBUILDCommunityTasks)\MSBuild.Community.Tasks.Targets"/>
  <!--Include wix files here:-->
  <ItemGroup>
    <WixExtension Include="WixUtilExtension">
      <HintPath>$(WixToolPath)\WixUtilExtension.dll</HintPath>
    </WixExtension>
    <WixExtension Include="WixUIExtension">
      <HintPath>$(WixToolPath)\WixUIExtension.dll</HintPath>
    </WixExtension>
  </ItemGroup>
  <ItemGroup>
    <Content Include="Config.wxi" />
    <Compile Include="Product.wxs" />
    <Compile Include="WixUI_Minimal_NoLicense.wxs" />
    <Compile Include="Components.wxs" />
  </ItemGroup>
  <PropertyGroup>
    Version;
    $(CoreBuildDependsOn)
  </PropertyGroup>
  <!--Get Subversion Revision here-you must use MSBUILDCommunityTasks:-->
  <Target Name="Version" >
    <SvnVersion ToolPath="$(Subversion)" LocalPath="..\">
      <Output TaskParameter="Revision" PropertyName="Revision"/>
    </SvnVersion>
    <Message Text="Version: $(Revision)" Importance="high"/>
    <PropertyGroup>
      
<DefineConstants>$(DefineConstants);SubversionRevision=$(Revision)</DefineConstants>
    </PropertyGroup>
  </Target>
  <!--Output based on Release or Debug-->
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86'">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
    <DefineConstants>Debug;ReleaseDir=..\MYAPP\bin\Release\</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86'">
    <OutputPath>bin\$(Configuration)\</OutputPath>
    <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
    <DefineConstants>Debug;ReleaseDir=..\MYAPP\bin\Release\</DefineConstants>
  </PropertyGroup>
</Project>

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: Brian Bakkebo [mailto:bbakk...@gmail.com]
> Sent: Wednesday, April 22, 2009 4:27 PM
> To: General discussion for Windows Installer XML toolset.
> Subject: Re: [WiX-users] Subversion revision number through a
> wixproject file using msbuild community tasks
>
> Thanks again for your response EdwinYep, I use the same CollabNet
> release for testing.  Yep, I expected that also, but I dont see it,
> which leads me to believe that there is some kind of pathing/mapping
> problem.  Also, I am not quite sure on the syntax for DefineConstants
> inside the version target.
>  Here is my project file.  Hope you can see what the problem is..Thanks
> for your help.
>
> <Project DefaultTargets="Build" xmlns="
> http://schemas.microsoft.com/developer/msbuild/2003";>
>   <!--Main Property group-->
>   <PropertyGroup>
>     <Configuration Condition=" '$(Configuration)' == ''
> ">Debug</Configuration>
>     <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
>     <ProductVersion>1.0</ProductVersion>
>     <ProjectGuid>{1bc4cf27-badd-47e0-87a7-9e3ed0c8c50b}</ProjectGuid>
>     <SchemaVersion>2.0</SchemaVersion>
>     <OutputName>Wix_TagImport</OutputName>
>     <OutputType>Package</OutputType>
>     <WixToolPath>..\..\DLL\Wix\</WixToolPath>
> <Subversion>..\..\DLL\CollabNet Subversion Client</Subversion>
> <MSBUILDCommunityTasks>..\..\DLL\MSBuildCommunityTasks\</MSBUILDCommuni
> tyTasks>
>     <WixTasksPath>$(WixToolPath)\wixtasks.dll</WixTasksPath>
>     <WixTargetsPath>$(WixToolPath)\Wix.targets</WixTargetsPath>
>     <Cultures>en-us</Cultures>
>     <LinkerBaseInputPaths>..\MYAPP\bin\Release</LinkerBaseInputPaths>
>   </PropertyGroup>
>   <Import Project="$(WixToolPath)\Wix.targets" />
>   <Import
> Project="$(MSBUILDCommunityTasks)\MSBuild.Community.Tasks.Targets"
> />
>    <!--Include wix files here:-->
>   <ItemGroup>
>     <WixExtension Include="WixUtilExtension">
>       <HintPath>$(WixToolPath)\WixUtilExtension.dll</HintPath>
>     </WixExtension>
>     <WixExtension Include="WixUIExtension">
>       <HintPath>$(WixToolPath)\WixUIExtension.dll</HintPath>
>     </WixExtension>
>   </ItemGroup>
>   <ItemGroup>
> <Content Include="Config.wxi" />
>     <Compile Include="Product.wxs" />
>     <Compile Include="WixUI_Minimal_NoLicense.wxs" />
>     <Compile Include="Components.wxs" />
>   </ItemGroup>
>   <!--Get Subversion Revision here-you must use MSBUILDCommunityTasks:-
> ->
>   <Target Name="Version" >
>   <SvnVersion ToolPath="$(Subversion)" LocalPath="..\">
>    <Output TaskParameter="Revision" PropertyName="Revision"/>
>    <DefineConstants>SubversionRevision=$(Revision)</DefineConstants>
>   </SvnVersion>
>   <Message Text="Version: $(Revision)" Importance="high"/>
>   </Target>
>   <!--Output based on Release or Debug-->
>   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' ==
> 'Debug|x86'
> ">
>     <OutputPath>bin\$(Configuration)\</OutputPath>
>
> <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
> <DefineConstants>Debug;ReleaseDir=..\MYAPP\bin\Release\</DefineConstant
> s>
>   </PropertyGroup>
>   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' ==
> 'Release|x86'
> ">
>     <OutputPath>bin\$(Configuration)\</OutputPath>
>
> <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
> <DefineConstants>Debug;ReleaseDir=..\MYAPP\bin\Release\</DefineConstant
> s>
>   </PropertyGroup>
>
> </Project>
>
>
>
>
>
> 2009/4/23 Castro, Edwin (Hillsboro) <edwin.cas...@fiserv.com>
>
> > My example depended on having the CollabNet distribution of
> subversion.
> > Find out where svnversion.exe lives on your system.
> >
> > I expect <Message Text="Version: $(Revision)"/> to print something
> > like the
> > following:
> >
> > Version: 5425
> >
> > Are you declaring DefineConstants in the same target where
> > <SvnVersion/> runs? If not, then $(Version) will contain the default
> > value (empty string) and cause problems. Perhaps I can be of more
> help
> > if you show me your *.wixproj file.
> >
> > Edwin G. Castro
> > Software Developer - Staff
> > Electronic Banking Services
> > Fiserv
> > Office: 503-746-0643
> > Fax: 503-617-0291
> > www.fiserv.com
> > P Please consider the environment before printing this e-mail
> >
> >
> > > -----Original Message-----
> > > From: Brian Bakkebo [mailto:bbakk...@gmail.com]
> > > Sent: Wednesday, April 22, 2009 3:03 PM
> > > To: General discussion for Windows Installer XML toolset.
> > > Subject: Re: [WiX-users] Subversion revision number through a
> > > wixproject file using msbuild community tasks
> > >
> > > Hello Edwin thanks for your response.I had the toolpath there
> before
> > > and it didnt seem to make any difference, but I added it back
> again.
> > > Actually, I cut and pasted what you had exactly and it still seems
> > > like nothing is happening??
> > >
> > > Couple of questions:
> > > 1.  Should I see this(Version: =MyRevisionValue) in the output
> > > window of visual studio when I build the wixproj?  I have also
> tried
> > > to run it from msbuild and I dont see anything.
> > > 2.  Could it be the way I am passing the variables from the wixproj
> > > to my product.wxs file?
> > > This is how I am doing it.
> > >
> <DefineConstants>Debug;ReleaseDir=..\ProgramName\bin\Release\;Subver
> > > sio nRevision=$(Revision)</DefineConstants>
> > >
> > > Any help is greatly appreciated.
> > >
> > > Brian
> > >
> > > 2009/4/22 Castro, Edwin (Hillsboro) <edwin.cas...@fiserv.com>
> > >
> > > > First check that LocalPath is pointing to the correct location.
> > > > Sometimes the bug is sooo trivial we don't notice it. ;-)
> > > >
> > > > <SvnVersion/> expects svnversion.exe to live at
> > > > $(ProgramFiles)\Subversion\bin. If it doesn't live there, then
> > > specify
> > > > ToolPath to the directory where it does live. Example:
> > > >
> > > > <SvnVersion ToolPath="$(ProgramFiles)\CollabNet Subversion
> Client"
> > > > LocalPath="..\">
> > > >   <Output TaskParameter="Revision" PropertyName="Revision"/>
> > > > </SvnVersion>
> > > >
> > > > Use <Message Text="Version: $(Revision)" Importance="high"/>
> while
> > > > testing to make it easier for the revision to be printed. The
> > > > verbosity level of msbuild can affect whether these messages are
> > > printed or not.
> > > >
> > > > Edwin G. Castro
> > > > Software Developer - Staff
> > > > Electronic Banking Services
> > > > Fiserv
> > > > Office: 503-746-0643
> > > > Fax: 503-617-0291
> > > > www.fiserv.com
> > > > P Please consider the environment before printing this e-mail
> > > >
> > > > > -----Original Message-----
> > > > > From: Brian Bakkebo [mailto:bbakk...@gmail.com]
> > > > > Sent: Wednesday, April 22, 2009 11:16 AM
> > > > > To: General discussion for Windows Installer XML toolset.
> > > > > Subject: [WiX-users] Subversion revision number through a
> > > wixproject
> > > > > file using msbuild community tasks
> > > > >
> > > > > I realize this probably isnt the right place for this, but I am
> > > > > hoping someone else has got this working and could just give me
> > > > > a hand or better the code...
> > > > >
> > > > > I am trying get subversion revision number through a wixproj
> > > > > file using msbuild community tasks and it is not working!
> > > > > Here is the script I am using. I am not seeing any output in
> the
> > > > > revision.
> > > > > <Import
> > > > >
> Project="$(MSBUILDCommunityTasks)\MSBuild.Community.Tasks.Targets"
> > > > > /> <!--Get Subversion Revision here-you must use
> > > > > MSBUILDCommunityTasks:--> <Target Name="Version" > <SvnVersion
> > > > > LocalPath="..\" > <Output TaskParameter="Revision"
> > > > > PropertyName="Revision" /> </SvnVersion> <Message
> > > > > Text="Version: $(Revision)"/> </Target>
> > > > >
> > > > > Thanks in advance.
> > > > > Brian
> > > > > ---------------------------------------------------------------
> -
> > > > > ---
> > > -
> > > > > ---
> > > > > -------
> > > > > Stay on top of everything new and different, both inside and
> > > > > around Java (TM) technology - register by April 22, and save
> > > > > $200 on the JavaOne (SM) conference, June 2-5, 2009, San
> Francisco.
> > > > > 300 plus technical and hands-on sessions. Register today.
> > > > > Use priority code J9JMT32. http://p.sf.net/sfu/p
> > > > > _______________________________________________
> > > > > WiX-users mailing list
> > > > > WiX-users@lists.sourceforge.net
> > > > > https://lists.sourceforge.net/lists/listinfo/wix-users
> > > >
> > > > -----------------------------------------------------------------
> -
> > > > ---
> > > -
> > > > -------- Stay on top of everything new and different, both inside
> > > > and around Java (TM) technology - register by April 22, and save
> > > > $200 on the JavaOne (SM) conference, June 2-5, 2009, San
> Francisco.
> > > > 300 plus technical and hands-on sessions. Register today.
> > > > Use priority code J9JMT32. http://p.sf.net/sfu/p
> > > > _______________________________________________
> > > > WiX-users mailing list
> > > > WiX-users@lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/wix-users
> > > >
> >
> > ---------------------------------------------------------------------
> -
> > -------- Stay on top of everything new and different, both inside and
> > around Java (TM) technology - register by April 22, and save $200 on
> > the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> > 300 plus technical and hands-on sessions. Register today.
> > Use priority code J9JMT32. http://p.sf.net/sfu/p
> > _______________________________________________
> > WiX-users mailing list
> > WiX-users@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wix-users
> >
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to