Geeks With Blogs

News View Michael Stephenson's profile on BizTalk Blog Doc View Michael Stephenson's profile on LinkedIn

Michael Stephenson keeping your feet on premise while your heads in the cloud

Recently I have been working with a customer where we wanted to migrate some source code to TFS Services for source control but we had an existing Build Server setup running on-premise with Cruise Control. We did not want to change this over to any other continuous integration server so we were hoping to just point to our new TFS server in the cloud and it would all be straightforward. Unfortunately it wasn't this easy.

The core of our problem is that the CCnet plug in for Team Foundation Server (the vsts source control plugin) is implemented as a wrapper for TF.exe. TF.exe seems to only work with TFS Services when you have logged in with your Windows Live ID credentials. There are a few articles out there about automation of TFS Services but to be honest at this stage there seems to be a lot of people struggling with how to automate properly and particularly around the different security options. Also bottom line is that none of the articles I have seem discuss how to make TF.exe work with TFS Service without logging in via Windows Live ID.

Eventually I have managed to get this scenario working but it was quite painful so ill document it here to help anyone else who may be struggling. The approach I have taken refers back to the TFS Plugin on Codeplex for CCNet (http://tfsccnetplugin.codeplex.com/). This plugin doesn't seem to have been updated for ages so I'm not sure if it is still maintained now that CCnet has its own TFS provider. The key thing about the codeplex plugin though is that it uses the TFS assemblies rather than TF.exe so I'm going to modify that plugin to work with TFS Sevrice and the rest of this article will show you how to do it.

Before you start

Before we get into the details of this we will assume that you have just installed the latest version of Cruise Control.net. I have tested this with version 1.8.3 but I'm pretty sure it would work with earlier versions too.

 

Step 1: Getting your TFS Credentials

Before we get into the CCnet space, you will need your TFS Services credential set which will allow you to authenticate without Windows Live ID. To do this you need to use the TFS Credential Viewer Tool

The tool is available on the following page: http://blog.hinshelwood.com/tfs-service-credential-viewer/

The following video also shows you how to use the tool: http://youtu.be/Fkn6V0_zz28

Once you have used the tool to get your credentials you will have the following information:

 

Step 2: Modifying CCnet to work with .net 4

We will be writing a new plugin for CCnet to use TFS Service which will need to use the TFS objects which come with Visual Studio 2012, now you may be able to get away with writing this in older versions of Visual Studio but I was having issues with this so I have written the code in Visual Studio 2010 and targeted .net 4.0. Because Cruise Control is a .net 2.0 application by default I have modified it to run in the .net 4.0 runtime instead. If you need more info on this please refer to the following article: http://www.davidmoore.info/2010/12/17/running-net-2-runtime-applications-under-the-net-4-runtime/

To implement this change I have modified the following configuration files in the Cruise Control Server folder:

  • ccnet.exe.config
  • ccservice.exe.config

I have modified the runtime element to include the highlighted test telling .net 4 to use the legacy security policy.

<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

<dependentAssembly>

<assemblyIdentity name="NetReflector" publicKeyToken="2f4dd8b32acbcd8e" culture="neutral" />

<bindingRedirect oldVersion="1.0.0.120" newVersion="1.1.2009.1214"/>

</dependentAssembly>

</assemblyBinding>

<NetFx40_LegacySecurityPolicy enabled="true"/>

</runtime>

 

I have also added the startup element to tell it to use .net 4 but to support .net 2.

<startup useLegacyV2RuntimeActivationPolicy="true">

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>

</startup>

 

Step 3: The CCNet Plugin

I have taken the code from the Codeplex TFS Plugin and modified it in two ways.

Firstly I have changed and parts where it used the AuthenticatedUser property of the sourceControl variable to use the AuthorizedUser property instead.

The 2nd change is to the TFS property where I have changed how the TeamFoundationServer reference is provided. It will use the SimpleWebTokenCredential so we can use the Identity we got credentials for in step 1 rather than an active directory based identity that you would have for an on-premise TFS instance. The below code snippet shows this:

var creds = new TfsClientCredentials(new SimpleWebTokenCredential(Username, Password));

var tfs = new TfsTeamProjectCollection(new Uri(this.Server), creds);

return tfs.TeamFoundationServer;

 

 

The code for this plug in is available at the following location:

https://s3.amazonaws.com/CSCBlogSamples/CCNetTfs.zip

 

One key point to node about the plugin is that the dll name needs to be ccnet.*.plugin.dll so that it is picked up by the reflection process used by CCnet. When I have compiled the assembly I simply copy it to the CCnet folder where the ccnet.exe file is.

 

Step 4: Modify the CCnet.config File

The ccnet.config file contains the definition of the project. I will need to modify the source control element to use my new plugin. The configuration for the plugin is very similar to the out of the box vsts source control plugin except that you don't need the executablePath property because we aren't using TF.exe. You would need to supply the username and password properties that you wouldn't usually supply on-premise (unless you were using a different account).

An example of this configuration is below (note I have highlighted the name of the new plugin):

 

     <sourcecontrol type="tfsservice" autoGetSource="true" applyLabel="true">

        <server>https://<yourTFSname>.visualstudio.com/DefaultCollection</server>

        <project>$/<Your project path></project>

        <cleanCopy>false</cleanCopy>

         <deleteWorkspace>false</deleteWorkspace>

         <workspace>TestWorkspace</workspace>

        <workingDirectory>C:\TFS</workingDirectory>

        <username>Account Service (<yourTFSname>)</username>

        <password><My Password></password>

</sourcecontrol>

You are now ready to restart your ccnet windows service and the project should pick up your new plugin.

 

Conclusion

Although it was initially painful to figure out how to do this hopefully you can see that Cruise Control can be used to connect to TFS Service to build your code.

 

 

 

 

 

 

 

 

 

 

Posted on Thursday, March 28, 2013 12:48 PM | Back to top


Comments on this post: Cruise Control.net and Team Foundation Services

# captcha site
Requesting Gravatar...
This is a content base article.Thanks writer
Left by captcha on Mar 28, 2013 5:48 PM

# captcha site
Requesting Gravatar...
This is a content base article.Thanks writer.Only i love the writer
Left by captcha on Mar 28, 2013 5:49 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
i can not understand the Step 3 above.
I dont know what was you doing.?
Can you explain more clearly.
Thanks.
Left by lam le on Mar 28, 2013 8:54 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Thank you so much. I spend hours, and after beating my head on the wall several times and almost giving up, I came across your article. This article saved a project of mine and I cannot express how grateful I am. Thank You!
Left by Anish on Apr 09, 2013 5:12 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Thanks for the tips, this simplifies things.
Left by Jack on Apr 16, 2013 2:27 AM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Hi, I have been following your steps (thanks so much btw!!)

All seems to be going well except CC doesn't accept the plugin DLL, when I run the config checker app it creates this error:

"Unable to create an instance of reflected type 'ThoughtWorks.CruiseControl.Core.SourceControl.TfsService.' Please verify that this object has a default constructor."

Did you come across anything like this / or have any idea what's causing it to fail?

Cheers!
Left by Jamie on Apr 28, 2013 11:19 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Hi, i followed the this four steps that you mentioned above, but i am not able to integrate cruise control.net to TFS 2012, because when i start the cruise control server, it crash everytime.

Please help me in this, because its very urgent for me to integrate cruise control .net with TFS 2012,

Please reply me soon about my query ASAP.

Left by yash shah on Feb 26, 2014 4:15 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Go to run command and type eventvwr it will show you why your service failed. My service failed because I didnt place the dll "ccnet.tfsservice.plugin.dll" in right place. It should be placed where CCNet service is running.
Left by Senthil on Mar 03, 2014 10:57 AM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Super thanks. After trying hundreds ways and struggling with this solution, it finally works at the end.
Left by Minh on Mar 26, 2014 6:57 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Supeeer supeeer Thanks for you..
its works for me...
Left by Nuril Umam on Mar 13, 2015 6:44 AM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Works great, thank you!


Borderless Software
Left by Martin on May 14, 2015 2:25 AM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Voyage Control is unquestionably the most mainstream assemble framework accessible. It's an open-source arrangement that has been around for quite a long time, works with a wide range of source control and store frameworks, and has an enormous group of clients and module designers. Please Visit Our Website www.EssayThinker.co.uk
Left by Jack kevin on Dec 08, 2016 6:27 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
I ran over your article. This article spared a venture of mine and I can't express how appreciative I am. Go to run summon and sort eventvwr it will demonstrate to you why your administration fizzled. My administration fizzled on the grounds that I didnt put the dll "ccnet.tfsservice.plugin.dll" in correct place. It ought to be put where CCNet administration is running. http://www.researchpapertown.com/researchpaper-editing/
Left by WatsonZion on Jan 12, 2017 12:37 AM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
My profile is an academic writer in my company. I write students' academic coursework keeping the university criteria in mind. Students from various part of the world opt for our assignment help online and get a quality coursework written from us. https://www.allassignmenthelp.co.uk
Left by Assignment help on Feb 03, 2017 6:33 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Physical pain is less torch able than compare to other comment database sql books
Left by deepak on Feb 06, 2017 5:39 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
There are something very unique in order to keep doing something amazing and very supportive in order to make sure that we have a great environment in society http://www.assignmentkeen.com/
Left by Austin micheal on Feb 06, 2017 10:04 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
We always need to cover something very unique but we still have to do something for our life in a good environment and society http://www.assignmentkeen.com/
Left by Austin micheal on Feb 06, 2017 10:06 PM

# Incremental Analysis Accounting Assignments Help
Requesting Gravatar...
I personally like your post; you have shared good insights and experiences. Keep it up.
http://www.accountingassignments.help/
Left by Incremental Analysis Accounting on Mar 23, 2017 11:13 PM

# WINDOWS-CUSTOMER-SUPPORT
Requesting Gravatar...
Those people who's facing troubleshooting problems in Microsoft windows, please call us on windows support number.
http://www.msofficesupportnumber.com/microsoft-windows-support.html
Left by <a href=http://www.msofficesuppo on Mar 24, 2017 6:13 AM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Favorite videos, make picture videos adding http://vivavideo.download2 is also available in many languages into countries.
Left by edwardian on Aug 01, 2017 10:59 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Favorite videos, make picture videos adding Viva Video Download is also available in many languages into countries
Left by dravidian on Aug 01, 2017 11:16 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
your favorite videos, make picture videos adding Viva Video Download is also available in many languages into countries.
Left by dravidian on Aug 01, 2017 11:17 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
As of late I have been working with a client where we needed to move some source code to TFS Services for source control yet we had a current Build Server setup running on-start with Cruise Control Coursework Writing. We would not like to change this over to some other ceaseless mix server so we were wanting to simply point to our new TFS server in the cloud and it would all be clear. Shockingly it wasn't this simple.
Left by kevin kruse on Aug 01, 2017 11:26 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
It's an open-source course of action that has been around for a significant long time, works with an extensive variety of source control and store structures, and has a gigantic gathering of customers and module originators. This article saved a wander of mine and I can't express Assignment Writers how grateful I am. Go to run summon and sort occasion it will show to you why your organization failed.
Left by WadeZack on Aug 03, 2017 5:44 PM

# Make My SPSS Homework
Requesting Gravatar...
Hi buddy, your blog' s design is simple and clean and i like it. Your Make My SPSS Homework blog posts about Online Dissertation Help are superb. Please keep them coming. Greets!!
Left by Philip Kayden on Aug 07, 2017 7:51 PM

# Online Medical Thesis Writing Service
Requesting Gravatar...
Really i appreciate the effort you made to share the knowledge. This Online Medical Thesis Writing Service is really a great stuff for sharing. Keep it up . Thanks for sharing.
Left by Online Medical Thesis Writing Se on Aug 07, 2017 10:15 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
It's an open-source plan that has been around for a significant long time, works with an extensive variety of source control and store structures, and has a gigantic gathering of Daily Homework Help customers and module planners. This article saved a wander of mine and I can't express how grateful I am. Go to run summon and sort occasion it will show to you why your organization failed.
Left by Daily Homework Help on Aug 10, 2017 9:18 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Play this incredible simulation android https://apkguys.com of locations are offered, Like park, Helipad.
Left by yanez on Oct 02, 2017 10:06 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Left by madina on Oct 05, 2017 10:03 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
As well as complimentary version app on your Mobdro for PC Security choose Unknown Sources.
Left by hugus on Oct 15, 2017 11:14 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
best gift card in free visa gift code generator
Left by pita on Nov 06, 2017 8:23 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Before we want to start these, it is necessary to install the latest version of the cruise control.net. It will be tested and almost sure that it could be work with earlier version. Thank you for sharing the steps needed for the installation. Keep update more details.snoredoc snoring solutions
Left by danette on Nov 07, 2017 11:30 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
I hope my site will be Google accepted and put it ahead so that I can grow and hope that it will come to me.
dumb ways to die
fireboy and watergirl 4
Left by chelsieanayas on Nov 08, 2017 8:06 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
While reading through the post, I came to know about the installation of TFS services and how to use the cruise control.net applications in detail. This will be a very good detail for the beginners and can do a lot better with this tool. anti snoring mouth guard
Left by lionel on Nov 15, 2017 9:42 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Currently, I've been operating with a customer where we desired to emigrate some supplied code to TFS offerings for source control however we had a current build Server setup running on-premise with Cruise control academic writing tips. We did no longer want to change this over to every other non-stop integration server so we have been hoping to simply point to our new TFS server inside the cloud and it'd all be sincere. regrettably, it wasn't this clean.
Left by William Arnold on Nov 21, 2017 12:33 AM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Thanks for sharing this amazing article and Drastic Ds Emulator Apk version is best app for android users. Thanks again
Left by Rohit on Dec 03, 2017 1:19 AM

# apkoftheday
Requesting Gravatar...
Graphics as well as noises. Something brand-new is being available in each. Click Here you will certainly have home entertainment. So game enthusiasts don't.
Left by Emily on Dec 18, 2017 5:38 PM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
Thanks for sharing nice one best sewing machine for beginners on a budget
Left by Sew on Jan 20, 2018 3:48 AM

# re: Cruise Control.net and Team Foundation Services
Requesting Gravatar...
It is good that you have installed the latest version of Cruise control.net over here. Thank you so much for sharing the step by step details here. It help us to easy understanding of the procedures and that helps lots of people here.louvre museum tour
Left by Dorrah on Feb 12, 2018 11:51 PM

Your comment:
 (will show your gravatar)


Copyright © Michael Stephenson | Powered by: GeeksWithBlogs.net