Geeks With Blogs
Matt deClercq



I have just completed the arduous process of integrating ClickOnce deployment (with the ability to have multiple versions installed side-by-side EX: DEV,QA,UAT) into my TFS 2010 build script. This took me about a week due to lack of materials on the web. So for everyone else out there attempting this here is what I did to make it work.

In order for this to work you must have the MSBUILD community tasks installed on you build server. You can download these from here

1) Create a "version.txt" file in your ClickOnce deployment virtual directory to track the app version:

- The file "version.txt is one single line and it follows the "Major.Minor.Build.Revision" standard (

- The following step uses the MSBUILD community tasks to read this file and update the app version

2) Create custom target file to handle all manifest/bootstrapper generation as well as the deployment web page template:

- Create the deployment web page template in a well known (easily accessible) place in the project directory (mine is under a filder I created called "Publish")

    - The template file I used can be downloaded from my SkyDrive at ClickOnce Publish Page Template. Thanks to the DeveloperMine blog for supplying the initial template and steps to modify.

- Create the custom target file in the root of your project directory (Mine is named ClickOnceDeployment.targets)

    - The contents of the ClickOnceDeployment.targets file are as follows (download file from my SkyDrive at ClickOnceDeployment.targets):


3) Modify your .csproj (C#) file to import the custom target file when it is a teambuild:

- Open your .csproj file in notepad or any otehr text editor and add the following line to the very bottom of the file.

<Import Condition="'$(BuildingInsideVisualStudio)' == 'false' AND $(BuildEnvironment) != '' AND '$(DeployClient)' == 'true'" Project="ClickOnceDeployment.targets" />

- The condition statement is reading some out of box and custom MSBUILD properties that we will define and set when we create our build definition to actually perform the build/deploy. In the end, this <Import> block will only run if the conditions are met which will in turn only run the code in out ClickOnceDeployment.targets file if these conditions are met.

4) Create build script template to provide the expected parameters to the custom target file and call MSBUILD on your project:


These steps were compiled from many different sources and heavily modified to fit my specific situation. I know that there are prob places where this can be improved upon and if you happen to have feedback please leave it in the comments.

Hope that this shortens the amount of time it takes you to get ClickOnce working with TFS 2010.

Posted on Friday, August 27, 2010 1:00 PM Software - Team Foundation Server | Back to top

Comments on this post: TFS 2010 and ClickOnce deployment w/ Multi-Environment Install Support

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Matt deClercq | Powered by: