# Wednesday, 24 June 2015

I wrote this article more as a reminder to myself on the process I need to go through to make a web application written in ASP.NET (MVC) that uses the TFS API to actually work. I have done this several times now but keep on forgetting some of the key information. Some of the errors you may get if you haven’t set this up correctly are.

Error HRESULT E_FAIL has been returned from a call to a COM component.

Microsoft.TeamFoundation.WorkItemTracking.Client.DataStore.DataStoreNative

There are two things you need to set correctly and they are your Web.Config and IIS.

Web.Config
The first port of call is to setup the following in your web.config. Basically we are saying we want to use Windows authentication in our app and to turn on impersonation.

1 <system.web> 2 <authentication mode="Windows" /> 3 <identity impersonate="true" /> 4 5 <authorization> 6 <deny users="?" /> 7 </authorization> 8 </system.web> 9 . 10 . 11 . 12 <system.webServer> 13 <validation validateIntegratedModeConfiguration="false"/> 14 . 15 . 16 </system.webServer> 17

IIS Settings
The rest of the settings are dealt with in IIS.

Authentication
In IIS click on your website and then select Authentication from the Features menu. Set these to the following (as per the image). Basically ASP.NET Impersonation, Windows Authentication are set to enabled. Anonymous should be set to Disabled.

image

App Pool Settings
Go to advanced settings on your App Pool, one thing you may need to set here is “Enable 32-Bit Applications” if you are working with the TFS Client API (this can be found under (General))

Scroll down to Process Model and find an identity section. This for a newly created app is usually set under the App Pool Identity account. This needs to be set to either a domain account that has access on the box or I have seen the local system and local service accounts also work here. However I believe this is only the case if you have set TFS to run under one of these as a service. In my case I have used an AD account that has access to the box. The next important step here is to set “Load User Profile” to true. Setting this appears to be critical especially when working with the WorkItem Tracking Client. I believe it needs to create a cache on disk when it does this. Not setting the Load User Profile may prevent it from doing this.

image



.
Tags: TFS

Wednesday, 24 June 2015 13:04:47 (GMT Daylight Time, UTC+01:00)  #    Comments [0]


# Thursday, 21 May 2015

This post is more for my own reference as I spent a bit of time trying to figure this one out. For a long time now you have been able to choose your own Team field in TFS and let TFS know this using the following method https://msdn.microsoft.com/en-us/library/vstudio/dn144940.aspx . I was recently working on an application where I needed to know the Team Fields name programmatically.  Below is the code I used to do this.

For the code below to work you will need to include

  • Microsoft.TeamFoundation.Client
  • Microsoft.TeamFoundation.Framework.Client;
  • Microsoft.TeamFoundation.Framework.Common;

In the example below we pass in the Guid of the TFS Collection we are after followed by the TFS project name. We then use the Process Configuration Service to get us the details about the project

1 var _tfsTeamProjectCollection = new TfsTeamProjectCollection(new Uri(_tfsUrl), 2 new System.Net.NetworkCredential(_tfsUserName, _tfsPassword)); 3 4 _tfsTeamProjectCollection.EnsureAuthenticated(); 5 6 var teamProjectCollection = 7 _tfsTeamProjectCollection.ConfigurationServer.GetTeamProjectCollection(tfsCollectionGuid); 8 9 var settings = teamProjectCollection.GetService<ProjectProcessConfigurationService>(); 10 11 ICommonStructureService4 cssService = teamProjectCollection.GetService<ICommonStructureService4>(); 12 13 var projectInfo = cssService.GetProjectFromName(projectName); 14 15 var proc = settings.GetProcessConfiguration(projectInfo.Uri); 16 17 var sets = proc.TypeFields; 18 19 string teamField = null; 20 21 foreach (var typeField in sets) 22 { 23 if (typeField.Type == FieldTypeEnum.Team) 24 { 25 teamField = typeField.Name; 26 } 27 }

I am sure the above code example can be tidied up and adapted a bit more.



.
Tags: TFS

Thursday, 21 May 2015 09:19:40 (GMT Daylight Time, UTC+01:00)  #    Comments [0]


# Thursday, 30 April 2015

One of the most exciting things I took away from Microsoft's Build 2015 event on day 1 apart from the fact they were embracing all platforms this time was how they proved that by releasing their first code editor that works for all environments Mac OS X, Linux and Windows. Visual Studio Code was a bit of wow moment for me it kind of said “They really mean it”

image

Visual Studio Code seems to have quite a light footprint. The install was pretty quick and as soon as the app launched I realised it looked strikingly familiar to Microsoft's online code editor I have been using for an Azure website called Monaco (below)

image

Visual Studio Code (below)

image

I would imagine that this is intentional so users have an online and offline version of the editor. To get started with development Microsoft have some tutorials setup specifically for Visual Studio Code. You can get started with a ASP.NET 5 app in Visual Studio Code using the tutorial found here. As Visual Studio Code is so light weight all scaffolding for your projects is done from the command line.

To get started with the tutorial you will need to install:

If you haven’t installed VS 2015 before you will need to install DNVM (.NET Version Manager) which you will later use to install dnx (this is covered in the tutorial)

NodeJS will also need to be installed which will install npm (the package manager for Node.JS) if you haven’t used npm before this, its not that clear from the tutorial.

After you have followed the tutorial you should have a scaffolded project you can view in Visual Studio Code. If you don’t want to go through the above tutorial you can always create the project in VS 2015 and then view it in Visual Studio Code.

What I like about this and saw quite a lot of this mentioned is how Microsoft is embracing other initiatives instead of reinventing the wheel and making everything the “Microsoft way” as they have previously done in the past.

image

image

 

Editing code in Visual Studio Code is a breeze and I quite like how light weight it is and if you have been using Monaco it shouldn’t seem too different to you especially the integrated Git access. You can also launch kestrel (the web server) from the command line. However while I was able to get most things working with Visual Studio Code I was unable to get Debugging working for my MVC application. The documentation does state that debugging is not yet supported in Mac OS X and Linux although I was using a Windows machine at the time.



.

Thursday, 30 April 2015 12:04:03 (GMT Daylight Time, UTC+01:00)  #    Comments [0]


# Monday, 26 January 2015

Checkout this excellent article by Mark Rendle on running ASP.NET 5 with Linux and Docker.

http://blog.markrendle.net/fun-with-asp-net-5-and-docker/?utm_content=buffer75e54&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer



.
Tags:

Monday, 26 January 2015 10:44:30 (GMT Standard Time, UTC+00:00)  #    Comments [0]


# Thursday, 22 January 2015

If you have been keeping up to date with Visual Studio 2015 news. You may have noticed that Microsoft has started adding touch support to Visual Studio 2015. I tried it out on my iPad yesterday and it seems to work quite nicely. How did I use Visual Studio 2015 on my iPad you may ask? Just install Microsoft's Free RDP client for iPad and connected to an Azure VM with VS 2015 installed. It works quite nicely and supports gestures such as pinching to zoom and selecting text with your finger. You can also use the scroll bar to scroll down with your finger.

VS2015Ipad

I would imagine that this would even work on an Android tablet (which now has support for a mouse plugged in) which Microsoft have also released an RDP client for. Or better yet a Windows tablet where you can use VS2015 on the device itself instead of through remote desktop.

VS2015iPad



.
Tags: VS2015

Thursday, 22 January 2015 15:12:05 (GMT Standard Time, UTC+00:00)  #    Comments [0]


# Tuesday, 20 January 2015

This was one that passed me by over the festive period. If you use the online version of TFS, you can now edit code inside the repository from the web interface and add new files to the repository completely from the web interface.

http://www.visualstudio.com/en-us/news/2014-dec-17-vso

The above functionality does not appear to be included in Update 4 of the standalone version of TFS.



.
Tags: TFS | TFS Tools

Tuesday, 20 January 2015 18:25:21 (GMT Standard Time, UTC+00:00)  #    Comments [0]


If you get the above error when installing TFS 2013 Update 4. You may find the following article useful.

http://blogs.msdn.com/b/heaths/archive/2014/05/23/update-does-not-apply-or-is-blocked-by-another-condition-on-your-computer.aspx

In my case I installed another program that required Update 4. In this case because it was a test machine I installed Visual Studio 2013 and Update 4 suddenly worked.



.
Tags:

Tuesday, 20 January 2015 17:41:14 (GMT Standard Time, UTC+00:00)  #    Comments [0]


# Friday, 05 December 2014

I’ve recently completed a project working with a great development team. Every time you work on a new project even in a software coaching role you hope people learn new things from you and that you also importantly learn new things from them. 

One of the things I found interesting was getting the team to follow Test Driven Development. The reason I was so adamant about it even down to being called “Mr Test” by the team, is that I like many other developers have been on projects where any kind of automated testing had been thrown out of the window or not been given the attention it deserves. All too many times teams have said they are following test driven development and not really know what it actually means. You may have heard the following.

  • “Its only a small change there’s no need to test it”
  • “I’ll write the tests later I just want to get it done.”
  • “I’ll put a task in the backlog to write the tests”
  • “I’ll write the code and you write the tests”

TDD aside, I think the first thing that has to be understood, is why unit testing is actually important. This is the example I like to use. When we build our application, its a bit like building a house, you need to ensure you have good strong foundations before you start building those brick walls. Software development is very similar in the example below our foundation is the code we have previously written and to ensure this code does what it is supposed to we protect what we have previously done with unit tests.

Our tests are our insurance policy. They ensure that our code behaves the way it was intended long after we have left it and moved along to the next piece of development.

image

Just like building the foundations of a house you don’t necessarily realise the consequences of doing it incorrectly until later. Unit testing is very much the same, its not until later that you realise your application is falling apart and you have absolutely no idea why. Every change you make to the application fills you with dread because you have no idea what you will end up breaking next. It can also be one of the reasons a team starts off with a high velocity and then suddenly slows down and stops delivering each sprint. 

When teams start to understand the picture above, the rest usually comes together quite easily. Developers start to realise that even if they are working alone in a team of one on some internal code the value of unit testing still applies to them.

TDD should then be a natural extension after the value of unit testing is fully grasped. Test Driven Development helps us think about the intent of our code, how we are going to test our application upfront, it makes us think about the design and can encourage good design at the same time.



.
Tags: Agile | TDD

Friday, 05 December 2014 12:41:17 (GMT Standard Time, UTC+00:00)  #    Comments [0]


# Thursday, 08 May 2014

This is more for my own reference. If you use iSubscriber in your applications you may have noticed they’ve stopped working in Update 2 of TFS 2013 because they can’t find WorkItemChangedEvent.

This is now located in Microsoft.TeamFoundation.WorkItemTracking.Server which can be found here.

C:\Program Files\Microsoft Team Foundation Server 12.0\Application Tier\Web Services\bin\Microsoft.TeamFoundation.WorkItemTracking.Server.dll



.
Tags: TFS

Thursday, 08 May 2014 13:11:15 (GMT Daylight Time, UTC+01:00)  #    Comments [0]


# Tuesday, 09 July 2013

LeanKit if you haven’t heard of it is a popular Kanban board available as a service over the Internet. I’ve used it myself and seen it used on several client sites in the past. However the one question I seem to be hearing lately is “can’t we use LeanKit for our tasks and TFS for code?”.

Its a reasonable question, Team Foundation Server depending on what version you are using gives you quite a lot of functionality out of the box. You could argue that if you have TFS 2012 you wouldn’t need to use a separate KanBan board. However just because you have a KanBan board doesn’t necessarily mean you’re writing code and an organisation may have been set on LeanKit way before TFS was introduced.

So can we have both?
You certainly can, and one sleepy afternoon I decided to see if I could get the two to talk to each other. The initial  integration between the two was a lot easier than I thought it would be, anyone who is familiar with REST and the TFS API would find it a breeze! And yes it answered the question of could it be done but it also raised several more questions!

  • Why?
  • What about conflicts?
  • Does this add value?

Now the “why” is probably self explanatory from the paragraphs above. However conflicts and “Does this type of integration actually add value” weren’t that straight forward. My conundrum wasn’t getting them to work together but more what to do about someone changing something in TFS and another changing something in LeanKit?

My Solution
So I came up with the following scenario.

“If you are storing tasks and editing them in LeanKit in the first place you’re probably not that likely to want to edit them in TFS? However when you check in your code you will probably want to associate your check in with a task you have been working on.”

While I appreciate the above probably doesn’t apply to everyone, this is one way with the least amount of effort I came up with for integrating the two that could add value. There are several more that I will go into in more detail on later.

Firstly I created a program that polled LeanKit for updates (I would have preferred an event service but couldn’t find one in the LeanKit API). I’ve called my simple polling app “LeanKit Kanban Caller” it basically goes over the tasks in LeanKit and ensure they exist in TFS.

image

If a task doesn’t exist in TFS the program creates one otherwise it just updates any existing tasks if they are different.

image

The program knows which task to associate with LeanKit because I altered the default Product Backlog Item WIT from the Scrum 2.0 template in TFS 2012 to store the LeanKit ID (note this type of integration should also work with TFS 2010 on a different template).

image

For the purposes of my experiment I only mapped the title, description and size fields across but mapping others is easy. I didn’t bother with the State of the item in TFS, partly because the state in LeanKit can be changed so easily by adding more columns while in TFS its a question of editing the workflow on the WIT. While it is possible to map these to each other it would end up making your board inflexible and for the purposes of this scenario we’re not actually using that field.

I have assumed that in TFS everything is a PBI and child tasks are redundant for the purpose of this scenario.

Pros and Cons of my approach

Pros
  • The polling app can sit on any machine that has the Team Explorer client installed and has an Internet connection
  • You can associate code check-ins with tasks from your LeanKit board as they now exist in TFS
  • Using LeanKit is business as usual as no changes are made to your LeanKit board

Cons

  • Changing a task in TFS will not update the task in LeanKit
  • The states in TFS are not mapped to those in LeanKit
  • Analysis tools in TFS for the backlog have no use with this scenario.

How else could we have worked?
There are several other ways in which I could have made this solution work.

  • Treat TFS as the master and overwrite anything in LeanKit (no real value)
  • Allow updates to go both ways and make use of the datetime stamp to determine if TFS updates LeanKit or if LeanKit updates TFS (could lead to conflicts).
  • Make TFS and LeanKit responsible for different fields. This way both can update each other sound in the knowledge that no data will be overwritten.

Are there any other scenarios? If you have any suggestions I’d love to hear them.



.
Tags: LeanKit | TFS | TFS Tools

Tuesday, 09 July 2013 14:31:00 (GMT Daylight Time, UTC+01:00)  #    Comments [0]