Tim Hibbard

Software Architect for EnGraph software
posts - 615, comments - 673, trackbacks - 469

My Links

News



Add to Google




Twitter












Tag Cloud

Article Categories

Archives

Post Categories

Image Galleries

EnGraph Blogs

Links

Other

Roll

Publishing a ClickOnce app with TeamBuild

After much frustration, I've finally configured our TeamBuild proj file to publish our ClickOnce app, and increase the version number (kinda an important step).  The Vertigo blog talks about using SolutionToPublish, but that doesn't work for all situations.  Specifically, when your solution contains projects that reference other projects. 

So I started playing with the MSBuild Community Tasks Project, and came up with the following Xml for my proj file:

This tells the .proj to use the community project:

<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\
   MSBuild.Community.Tasks.Targets"/>

This defines the version numbers:

<PropertyGroup>
    <Major>4</Major>
    <Minor>0</Minor>
    <Build>0</Build>
    <Revision>0</Revision>
</PropertyGroup>

 

This sets the Revision to the last Changeset in our TFS server, and sets the Build to a formatted date:

<Target Name="Version">
    <TfsVersion LocalPath="$(SolutionRoot)">
      <Output TaskParameter="Changeset" PropertyName="Revision"/>
    </TfsVersion>
    <Time Format="MMdd">
      <Output TaskParameter="FormattedTime" PropertyName="Build" />
    </Time>
</Target>

 

This tells TeamBuild to Publish this after the solution is compiled and after the Version code has been ran.  It publishes the ClickOnce project to the location PublishDir with the version set in ApplicationVersion:

<Target Name="AfterCompile" DependsOnTargets="Version">
    <MSBuild Projects="$(SolutionRoot)\dev\...\ParaPlan.csproj"
    Properties="PublishDir=\\server\drop\;ApplicationVersion=$(Major).$(Minor).$(Build).$(Revision)" 
    Targets="Publish" />
</Target>

 

The entire .proj file is here.

 

Print | posted on Friday, June 01, 2007 2:15 PM | Filed Under [ .NET Goldstar TFS ClickOnce ]

Feedback

Gravatar

# re: Publishing a ClickOnce app with TeamBuild

Nice. Thank you posting this...
6/1/2007 4:53 PM | Greg
Gravatar

# Publishing a ClickOnce app with Team Build

one of the things i want to build, eventually, is a Team Foundation Server. And the other thing is ClickOnce
6/3/2007 8:31 AM | Tiernans Comms Closet
Gravatar

# re: Publishing a ClickOnce app with TeamBuild

The problem with this is that the Target="Publish" causes your project to be compiled again before being published. You need to use PublishOnly to avoid the re-compiling. However, then you end up trying to publish from the csproj relative directory ... which isn't where the team server dropped your binaries.
1/29/2008 6:35 PM | Jeff Bailey
Gravatar

# re: Publishing a ClickOnce app with TeamBuild

I assume this solution does not currently work with TFS 2009.
4/23/2009 11:48 AM | Aaron Engel
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 

Powered by: