Tuesday, May 20, 2008

ClickOnce - Getting the Application version and putting it into the Publish.htm

My.RAM.Serialize() - TeamBuild ClickOnce Versioning

"It seems many people have had issues getting the version number correctly within their tfsbuild.proj files to use in their ClickOnce html files.  The solutions I've seen were very complicated, but this may be because the examples I've seen were in TFS 2005 or they were using different tasks.

My coworker added the SDC tasks to our build server because there is functionality for XML and file manipulation.  From his starting point I went on to look further into two specific tasks: Xml.GetValue and File.RegEx.

...

I manually published my project to get the publish.htm file.  I then made it a part of my project so that I could copy it to my published application's directory and modify the version number.  I edited the html file and put a #VERSION# tag so that the File.RegEx task could find it and replace it with the $(ResultsItem) variable.  We get $(ResultsItem) from the ItemName attribute of the Output element within the Xml.GetValue task element.  The following is the snippet of my tfsbuild.proj file that does the versioning of the publish.htm file:

..."

I've been pushing my team into getting our apps to be built via TeamBuild, no matter their deployment target, be it MSI or ClickOnce. Peter has been blogging about the things he's learned fighting this battle (besides "I learned my boss is a [fill in the blank]"  ;)

And with the above post, I believe the battle has finally been won! (Damn my guys are GOOD!)

Of course, being the manager that I am, I have now tasked them to write up a complete, start to finish, "how to" to capture and share their experience with TeamBuild/ClickOnce. My goal is not only share this with other developers in our Practice, but also with the development community via CodeProject.

If/when we publish it, you can bet I'll highlight it in a post.  :)

2 comments:

Unknown said...

Did you ever get that documentation? It would be very helpful :)

Greg said...

We did get it written, but I couldn't get approval from the IP Police to release it to the world...sigh... :(