views:

306

answers:

2

I need to be able to build a ClickOnce application in TFS 2010. It needs to set the ApplicationVersion as well as the MinimumApplicationVersion. In TFS 2008, I was successful in doing the following...

<MSBuild Projects="e:\MyAppBuilds\test\trunk\src\MyApp.Automation.Workflow.UI\MyApp.Automation.Workflow.UI.csproj"
         Properties=" PublishDir=\\MyServer\shared\MyCompany\Testing\MyApp\;
                      ApplicationVersion=$(Major).$(Minor).$(Build).$(Revision);
                      Configuration=$(Configuration);
                      Platform=$(Platform);
                      Install=true;
                      MinimumRequiredVersion=$(Major).$(Minor).$(Build).$(Revision)"
         Targets="PublishOnly"
         ContinueOnError="true" ToolsVersion="4.0"/>

However, I can't seem to get the MSBuild activity to publish the application properly by trying to replicate the task above in the activity. The settings I have are as follows.

CommandLineActivities = String.Format("/property:PublishDir=""{0}"" /property:Install=""true"" /property:Configuration=""{1}"" /property:Platform=""{2}"" /property:ApplicationVersion=""{3}"" /property:MinimumRequiredVersion=""{3}"" ", BuildDetail.DropLocationRoot, platformConfiguration.Configuration, platformConfiguration.Platform, VersionNumber)

Project localProject

Targets New String() {"Publish"}

Has anyone had success in doing this?

A: 

I think, your best bet would be to make a custom .proj file (msbuild) which you handtune to contain the call you already have. TFS can then build the custom .proj file.

Matthijs ter Woord
+1  A: 

I have a custom build process template which I branch from the Default process template. I then add a section after the build is successful to act on a new argument coming in that is an array of strings. These are the projects i want to deploy. I then use the MSBuild activity as MrHinsh suggests to target the Publish target. You can use the CommandLineArguments to customize the versioning information as we do. Here's a quick snippet of what I'm using for the app version of the click once installer:

String.Format("/p:SkipInvalidConfigurations=true;ApplicationVersion={1} {0}", PublishArguments, BuildVersion)

Ryan Cromwell
I've tried several things and basically, this is now where I'm at. I can use the MSBuild activity and arguments however, the application file created gives me the following error when I try to load it."Reference in the deployment does not match the identity defined in the application manifest."
e-rock
Are you able to publish successfully manually, from VS with the same information? My first guess would be the Version which has an impact on the trust information specified. I'm not a clickonce guru, but name, version, culture, and public key token are all used as trust identifiers.
Ryan Cromwell
Check this post out: http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/43353f07-307f-4f4f-b1d2-526c83b2681a/
Ryan Cromwell
Thanks Ryan. I'll look at the link you sent. This is really bizarre. If I right click on the project and click Publish, that works. However, if I'm in the project properties and use the Publish wizard or Publish Now, neither of those work. I just get "Error: Cannot publish because a project failed to build." with no other information. Ugh. I am not an expert on ClickOnce nor getting name/version/culture/public key tokens synched. I did this with another application and didn't have these problems. I'm not sure what's wrong.
e-rock
I'm not signing anything though, which is the weird thing. It's an internal application. I didn't have to do it before.
e-rock
This worked in a .NET 3.5 project, but I am now doing a .NET 4.0 WPF project.
e-rock