Incorporating a ClickOnce Application into your Team Build

I found out last week that the Team Build server doesn't perform the essential Publish step that makes a ClickOnce app, well, a ClickOnce app!

But this is easy enough to fix.

Let's start with a simple Hello World ClickOnce app that has one shared DLL dependency. If we do a Team Build for this app, we get the following files in the drop folder:

OneClickApp.application
OneClickApp.exe
OneClickApp.exe.manifest
SharedLibrary.dll

Notice anything missing? To be fair, even in the Visual Studio 2005 IDE, Publish is a seperate step from Build that you must manually invoke via a different menu.

Even if you're building and publishing the project remotely on the build server, you must Publish locally at least once, so all the Publish preferences are stored in the project files.

In order to Publish a project on the Team Build server, we have to make a small edit to the tfsbuild.proj file. Under the SolutionToBuild XML element, add a SolutionToPublish element:

<ItemGroup>
  <
SolutionToBuild Include="$(SolutionRoot)\OneClickApp.sln" />
  <
SolutionToPublish Include="$(SolutionRoot)\OneClickApp.sln" />
</
ItemGroup>

Check this change in, then try rebuilding. Now the drop folder contains the Publish results, too:

OneClickApp.application
OneClickApp.exe
OneClickApp.exe.manifest
SharedLibrary.dll
OneClickApp_1_0_0_0\OneClickApp.exe.deploy
OneClickApp_1_0_0_0\OneClickApp.exe.manifest
OneClickApp_1_0_0_0\SharedLibrary.dll.deploy
setup.exe

See all the new files at the bottom? With that small edit, this build is now functionally equivalent to a local Build plus Publish.

posted on Tuesday, February 20, 2007 2:00 PM by jatwood

Comments

# VSTS Links - 02/21/2007

Laurent Duveau on Team Foundation Server Workshop in Montreal.

GertD on SQL Server 2005 SP2.

The...
Wednesday, February 21, 2007 6:55 AM by Team System News

# re: Incorporating a ClickOnce Application into your Team Build

You should only need to specify SolutionToPublish. That should trigger both building and publishing.

Buck
Monday, February 26, 2007 7:46 PM by Buck Hodges

# re: Incorporating a ClickOnce Application into your Team Build

I'm getting an error indicating that a signing key is requried to publish and that I should publish from VS to configure this... however, if I do, nothing seems to change. Do I need to build it/publish it once manually directly on the build box?
Tuesday, May 08, 2007 3:29 PM by Rob

# Publishing a ClickOnce app with TeamBuild

Publishing a ClickOnce app with TeamBuild
Friday, June 01, 2007 12:15 PM by Tim Hibbard