Jun
3
2010

Build and Deployment automation, VCS Root and Labeling in TeamCity

As you might now from reading my blog I tend to automate as much as I can.

Why? Because I hate to do repetitive tasks. First because it is boring, at least for me, and as a developer we have more interesting things to do. Second because executing repetitive tasks tend to be error prone.

So last week I decided that it was enough for me to have to create manually a subversion tag for Jobpingweb site then also took the time to do the same for my portal Tech Head Brothers.

At Jobping we are using TeamCity and Subversion. We use it as our Continuous Integration system but also to deploy to production server in one click. Something I promised to talk later on in more details.

So it was relatively easy to configure TeamCity so that after build/deployment process it tags our subversion.

First of all, I realized only the other day the way TeamCity works with VCS root 

A VCS Root is a set of settings that defines how TeamCity communicates with a version control (SCM) system to monitor for changes and to get sources for a build.

We are using the convention of trunk, branches, tags in our Subversion server (which is the great Visual SVN Server). In the past I always set the TeamCity VCS Root to our myproject/trunk url, and I have seen lots of people doing so on different websites/blogs…

At this point I realized that I missed a point with TeamCity VCS Root is that it contains Root in it’s name. So I might be using myproject/ in place of myproject/trunk as the VCS Root. But wait, if I do that TeamCity agent will make a checkout of my whole Subversion repository!

And here comes the VCS Checkout rules, which you can configure on every project which is using the VCS Root

4663096481_231787d2d1_o[1]

So in my case it looks like that

4663731014_a4945d38d0_o[1]

Which specify that for that particular build I want to checkout from my VCS Root extended with trunk to the build folder /. So with that I restrict the checkout to the trunk. Good

Now back to my first topic, which was to automate the subversion tag creation when our build is successful which is done using TeamCity VCS Labeling.

Here is how we set it up for our staging build

4663125553_c725cbc3dc_o[1]

For sure we have another one for our production build.

And here is the result in Subversion

4663756592_592d22d287_o[1]

Another thing that I will not forget as it is automated

One last issue that I had which you see only if you register to get info about failed build in TeamCity is the following

[TeamCity, LABELING FAILED] Staging - CI Trunk, Unit Tests, Deploy #1072

Jetbrains.buildServer.vcs.VcsException:

Labeling the path 'trunk' to 'tags/staging-1072' has failed with the error: svn: MKACTIVITY of '/svn/!svn/act/7caf50f8-2801-0010-9e80-1fedd46c5a33': 403 Forbidden

With this error message it was then easy to figure it out. I just had to modify the access right of the build user to have read/write access right and not only read.

Feb
25
2009

Tech Head Brothers in St.Barth French West Indies

Thanks to Didier, now Tech Head Brothers, my french .NET portal is also known in the French West Indies island of St.Barth.

TechHeadBrothers and Innoveo are now well represented in Saint Barth ;-)

What about opening a subsidiary there for both?

Watch out the Tech Head Brothers sticker on the notebook!

Oct
27
2008

[PDC 2008] – Show off selection

Finally my video didn’t make it for the ShowOff contest at the PDC 2008. Here is the answer I’ve got:

I wanted to thank you again for your ShowOff entry. Unfortunately, due to the overwhelming response to ShowOff, we had to make some hard decisions about which entries we would be able to show during the event. We really liked your video, but unfortunately it didn't make it into our final cut this year.

So here the video I sent in which I demonstrate some of the possibilities of the Tech Head Brothers authoring tool based on Word 2007 and Open XML!

Sep
7
2008

Video of Tech Head Brothers new authoring tool based on Word 2007

In the following video I present the different features of the new authoring tool for my portal Tech Head Brothers.

First you will see the use of ClickOnce to enable easy installation on the author computer. This will also allow an easy update scenario. A great plus compared to the past.

Then you will see the Word 2007 template using to author the content of an article. It shows:

  1. Definition of the Title
  2. Definition of the Description
  3. Definition of the Keywords
  4. Writing of the content of a section of content with bold, italic, list, hyperlink
  5. Adding some sample code directly copied from Visual Studio 2008
  6. Inserting sample code in a zip
  7. Adding a picture captured using SnagIt yo the article
  8. Offline preview in Internet Explorer
  9. Posting to the Tech Head Brothers web site with Tags selection
  10. Online preview of the posted content

Enjoy the video! (Without sound, I couldn’t find a micro at home :()

Sep
6
2008

New step in my authoring tool using Word 2007

This evening I took the time to implement a new step on the new version of Tech Head Brothers authoring tool.

Now I am able to write an article in Word 2007 and post it using Web Services.

The next picture is the result of posting from Word 2007 on the web site using Web Services:

Here is how it looks like in Word:

To insert some source code sample as you can see on the Word 2007 picture or the web site, it is really easy. Go in Visual Studio, copy the code you want in the clipboard. Switch to Word 2007, then use the Source Code button:

To insert a picture, either use Windows Explorer to copy a file into the clipboard and paste it into the Word 2007 document, or use a tool like SnagIt from TechSmith (Thanks for the license by the way!!), make a screen shot, copy result into the clipboard and paste into Word 2007.

Is that easy!

This tool will make the authoring process on Tech Head Brothers so easy.

Aug
22
2008

Wowwwwww effect of my new Word 2007 authoring tool

I have reached now another step on the new authoring tool for Tech Head Brothers portal by having some authors installing this new version and starting beta testing it. Has you can see, with the following twit, it seems that the tool is on the good way:

From Rédo (french blog)

Just try the new beta tool of publishing for http://www.techheadbrothers... .... that's the Wouawwww effect !!! ... sorry, it's NDA ;p about 23 hours ago

From Jon Galloway (blog)

@laurentkempe Like I said, I'd pay money for it, and I'm very cheap. Very cool. about 15 hours ago from web in reply to laurentkempe

This tool let all authors write articles using a customized Word 2007, preview it offline in Internet Explorer as it will be seen on the portal and finally post the article to the portal directly from Word 2007. It is a replacement of THBAuthoring, my old tool found on CodePlex.

To achieve this goal I am using quite some technologies. First Word 2007, Ribbon, .NET Framework 3.5 SP1, VSTO 3.0, OpenXML, WordML, XML Schema, XSLT. Than for sure C#, Linq to XML, Linq to Object.

For the installation I use ClickOnce. That’s a great improvement! I had so much issues with THBAuthoring.

From an author point of view you are using a almost normal Word 2007 document with different predefined styles, bold, list… There is two exceptions:

  1. Source code
  2. Zip with sample code

The usage scenario for the inserting Source Code into the Word document is as following:

  1. Copy the code into the clipboard from Visual Studio 2008/2005
  2. Position the cursor into the Word 2007 document where you want to insert the Source Code
  3. Click on the button Source Code on the custom Ribbon
  4. That’s it, easy no?

This brings clear text of the source code into the document and colored source code into the HTML preview.

The usage scenario for attaching the Zip with the sample code is also easy:

  1. Click on the button Zip in the custom Ribbon
  2. In the opening File selector dialog browse to your zip file and select one
  3. That’s it, easy no?

Finally there is another usage scenario; inserting pictures:

  1. From Windows Explorer copy a picture file
  2. Position the cursor in the Word 2007 document
  3. Paste
  4. That’s it, easy no?

So, how does it work technically!

It works by doing a projection of the WordML to a well formed Tech Head Brothers XML document defined by an XML Schema. Then it uses a XSLT to produce HTML.

I hope to find the time to make a little video soon to demonstrate the way it is used!

Here is a picture of the tool

Aug
9
2008

Tech Head Brothers new authoring tool, step 8

For three night now I focused on one scenario for the Tech Head Brothers authoring tool:

  • As an author I want to be able to copy source code from Visual Studio and insert it into the authored Word document
  • As an author I want to preview a document with source code inserted in Internet Explorer

This might not look really difficult at first, but I had some difficulties to fulfill the requirements of those two user story.

The first one was almost already implemented in step 7, using CustomXML capabilities of WordML.

The biggest issue I had was to figure out why when I was inserting CustomXML, the WordML format of the hyperlink was changing. It took me the most time to realize that inserting CustomXML was not the issue. The issue was proofing. Somehow inserting CustomXML was activating the auto proofing and then I got some error like on the following picture. The red underlined Brothers which is a link was the issue. In fact this simple thing change the WordML representation of the hyperlink.

As I had something working I had to find a way other than adding a second way to parse Hyperlinks. I came to the solution of disabling proofing then saving the document before making my projection to Tech Head Brothers XML. Then for sure re-enabling the proofing. Nice and easy!

The next issue was to be able at the time of parsing the WordML to identify that source code was at at the current position in the WordML. I turned and turned the problem, than asked some clever WordML guys (Julien, Pierre) and some generally good advisor (Mitsu, Cyril). Nothing! I finally came to a solution tonight:

  1. Getting the Id of the PlainTextContentControl from the WordML
  2. Searching for this Control in the Controls collection
  3. Finally using the plainTextContentControl.XMLMapping.CustomXMLPart.XML property I had access to my CustomXML

I couldn’t find any way to do that parsing the WordML and honestly tonight I don’t know how it is possible to go from the WordML to the CustomXML.

The result is here!

Copying source code from Visual Studio

Inserting it in Word 2007

Final result in Internet Explorer

 

There is still a little bug with the spacing that will solved tomorrow or later!

Now the next steps will be:

  1. Projection of hyperlink
  2. Projection of picture
  3. Projection of numbered list and bullet list
  4. Fixing bugs found by Sébastien and Rédo
  5. Picture caption
  6. Giving the possibility to insert source code
  7. Projection of the source code
  8. Adding the possibility to the author to post the article directly from Word to Tech Head Brothers web site using secured web services made out of WCF
  9. Adding all validation of the content
Jun
7
2008

MSBuild and Silverlight 2.0 Beta 2 SDK running in Team City

First you need to un-install the Silverlight 2.0 Beta 1 SDK from the build server! Then you can download the Microsoft Silverlight Tools Beta 2 for Visual Studio 2008 and extract it on the server, there you will find the file silverlight_sdk.msi, that will allow you to install Silverlight 2.0 Beta 2 SDK.

Now if you followed my post MSBuild and Silverlight 2.0 Beta 1 running in Team City, then you know about the issue:

Using MSbuild to build a solution in a command line doesn’t copy the Silverlight project output to the linked web project

This issue is still there so my fix is still in my MSBuild file.

May
16
2008

Bringing Linq to Euss ORM

Euss stand for Evaluant Universal Storage Services, it's a great open source (MIT License) Object-Relational mapping framework.

I use Euss on Tech Head Brothers portal since a long time now.

Four days ago I went to Sébastien Ros, the architect of Euss, with a first draft implementation of IQueryable<T> for Euss. Almost everything was already implemented but it was missing the IQueryable<T>. Today Sébastien came back to me with a first implementation that I could quickly integrate.

As you can see on the following screenshots, made with NDepend, I was then able to remove the dependency on Euss from my Service Layer.

Before with dependency from TechHeadBrothers.Portal.Services to Evaluant.Uss

 

After without dependency from TechHeadBrothers.Portal.Services to Evaluant.Uss

Great new step!

Apr
30
2008

Run NCover through MSBuild in Team City

After one comment of Chris Walquist on one of my last post about Team City integration of NCover here is the way I run NCover through MSBuild in Team City.

First I need to import the Task of NCover.

<ProjectToolsVersion="3.5"DefaultTargets="Build"xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <UsingTask
TaskName="NCoverExplorer.MSBuildTasks.NCover"AssemblyFile="$(NCoverPath)\Build Task Plugins\NCoverExplorer.MSBuildTasks.dll" />
  <UsingTask
TaskName="NCoverExplorer.MSBuildTasks.NCoverExplorer"AssemblyFile="$(NCoverPath)\Build Task Plugins\NCoverExplorer.MSBuildTasks.dll" />

Then I define some properties:

    <!-- NCover -->
    <SolutionFolder>$(MSBuildProjectDirectory)\..\..</SolutionFolder>
    <TestsFolder>$(MSBuildProjectDirectory)\..\..\Tests</TestsFolder>
    <NCoverPath>C:\Program Files\NCover</NCoverPath>
    <NUnitPath>C:\Program Files\NUnit 2.4.6\bin</NUnitPath>
    <TestDll>TechHeadBrothers.Portal.DataAccess.Tests.dll TechHeadBrothers.Portal.DataAccess.dll</TestDll>
    <CoverageFile>..\..\Tests\Output\Coverage.xml</CoverageFile>
    <CoverageExclusions>Assembly=*.Tests</CoverageExclusions>
    <CoverageAssemblies>TechHeadBrothers.Portal.DataAccess;TechHeadBrothers.Portal.Domain;</CoverageAssemblies>

Then I have two targets:

  <Target Name="FullCoverage">
    <Message Text="#--------- Executing NCover ---------#" />
    <NCover ToolPath="$(NCoverPath)" 
            CommandLineExe="$(NUnitPath)\nunit-console.exe" 
            CommandLineArgs="$(TestDll)" 
            WorkingDirectory="$(TestsFolder)\Output\bin\Debug" 
            ProjectName="$(ProjectName)" 
            CoverageFile="$(CoverageFile)" 
            FileExclusionPatterns="$(CoverageExclusions)" 
            LogFile="Coverage.log" 
            AssemblyList="$(CoverageAssemblies)" />
    <!-- Summary Page -->
    <NCoverExplorer ToolPath="$(NCoverPath)" 
                    ProjectName="$(ProjectName)" 
                    OutputDir="$(TestsFolder)\Output" 
                    CoverageFiles="$(CoverageFile)" 
                    SatisfactoryCoverage="80" 
                    ReportType="ModuleClassSummary" 
                    HtmlReportName="CoverageSummary.html" />
    <!-- Full HTML Report -->
    <NCoverExplorer ToolPath="$(NCoverPath)" 
                    ProjectName="$(ProjectName)" 
                    OutputDir="$(TestsFolder)\Output\Coverage" 
                    CoverageFiles="$(CoverageFile)" 
                    SatisfactoryCoverage="80" 
                    ReportType="FullCoverageReport" 
                    HtmlReportName="Coverage.html" />
  </Target>

And finally in the target AfterBuild (more on that in this post) I call target SummaryCoverage or FullCoverage according to the configuration:

  <Target Name="AfterBuild">
    <CallTarget Condition=" '$(Configuration)' == 'Staging' " Targets="SummaryCoverage" ContinueOnError="false" />
    <CallTarget Condition=" '$(Configuration)' == 'Nightly' " Targets="FullCoverage" ContinueOnError="false" />

That's it!

Then Chris asked the following:

1) How did you get your "tests" tab to show up as well?  Did you have to run the tests with NUnitLauncher, and then run again for coverage?  I read that NUnitLauncher can't be used to profile, since it kicks off a separate process.

2) How did you get the "classes", "header", "index", etc. files?  I just get the summary.html.  I see options for this in ncover.console.exe but not in the <NCoverExplorer> target.

3) Did you use wildcard expressions to pass a list of test assemblies to NCover?  If so, would like to see how you did that, too.

1) I get the test tab configuring Team City to run my unit tests. That has nothing to do with NCover. And yes doing it so seems to run two time all unit tests. Here is a screen shot of my team city runner configuration:

2) Read this post "Using NDepend in Team City build management tool" that talks about for NDepend but shows configuration for NCover too.

3) The answer is on top of this post!

Hope it helps!

About Laurent

Laurent Kempé

Laurent Kempé is the editor, founder, and primary contributor of Tech Head Brothers, a French portal about Microsoft .NET technologies.

He is currently employed by Innoveo Solutions since 10/2007 as a Senior Solution Architect and certified Scrum Master.

Founder, owner and Managing Partner of Jobping, which provides a unique and efficient platform for connecting Microsoft skilled job seekers with employers using Microsoft technologies.

Laurent is awarded by Microsoft since Avril 2002: Most Valuable Professional (MVP).

MVP
Certified ScrumMaster
JetBrains Academy Member

My status

Twitter

Flickr

www.flickr.com
This is a Flickr badge showing public photos and videos from Laurent Kempé. Make your own badge here.

Month List

Page List