Rory Primrose

Learn from my mistakes, you don't have time to make them yourself

View project on GitHub

Running deployment tasks in a TFS lab build

I’ve been having issues running deployment tasks in a TFS build today. The batch file I’m getting it to execute on a target machine just doesn’t seem to find the setup packages in the TFS drop location. I suspected that it was executing the deployment steps using a local account on the target machine. Adding an echo %username% in the script confirmed that this was the case. Even though the target machine is a domain joined machine, local accounts won’t help with getting access to the TFS drop location which is secured by an ACL.

The account used to execute a deployment step is the lab agent service account identity on the target machine.image

By default this appears to be local system. You need to reconfigure the local Lab Agent service on the target machine in order to have it execute deployment steps under that account.image

The deployment step now identifies that it is executing under the correct credential. image

I still get a deployment step failure, but weirdly the deployment and the build were both successful.

Read More

That time that Pushys saved my ride

I’m trying to get out for a ride a couple of times a week. Yesterdays ride was a bit of misadventure though. At the 3km mark, I got a puncture. Do I turn back and cut my losses or keep going up the mountain on the spare to have fun on the downhill track? Hey, I have a spare and a repair kit. Up the hill we go.

I then get a second puncture 100m from the top of the mountain.

Up a hill without a tube

Read More

Issues updating to TFS 2012 Update 1

We encountered a couple of issues yesterday when updating TFS 2012 from RTM to Update 1. The installation went well on the application tier and the data tier. The upgrade for the build service hit some problems.


The event log on the application tier contains the following error:

Operand type clash: dbo.typ_BuildControllerTableV2 is incompatible with dbo.typ_BuildControllerTable (type SqlException)

With some quick escalation by Grant, our issues were resolved this morning. Grant has posted about it here.

The only other issue we seem to have hit is that exposing TFS over HTTPS was broken after the install. Brian Harry indicated this would be the case but did not elaborate on the details. It seems like the installation package for Update 1 has reset the IIS configuration back to its default TFS install. The affect of this is that the https binding was removed from the site. Simply adding this back in has restored our external TFS connectivity.

Read More

TFS alerts for changes to NuGet packages

I’ve been a little late to the NuGet bandwagon. Overall I am really happy with the service that NuGet provides. It is not all smooth sailing though and the following are the pain points I have hit:

  • Packages aren’t all strong named so our solution can’t be either
  • Package dependencies being updated might break other packages that depend on them
  • The amount of binding redirects added to config files is not always desirable and don’t always work
  • TFS get latest on a solution does not bring down NuGet package changes
Read More

Using WinMerge with VS2012

My Using WinMerge with TFS post has to be consistently the most viewed post on this site. I have finally been able to get around to posting updated reg files to support VS2012 on both x86 and x64 platforms (see the bottom of that post for the links). These reg files will configure VS2012 to use Winmerge for TFS diff/merge operations (no Visual Studio restart is required).


Read More

Crisis of Code Contracts faith

I really like Microsoft’s Code Contracts. The concept is absolutely great, but I’m starting to wonder if using them is worth it. Here are the pro’s and con’s as I see them.

Read More

TFS Build Remote Database Deployment Pain

I’ve been taking the pain today with an issue that provided a lot of misdirection. The setup is a build agent that uses a remote PowerShell session to install a setup package from the build output. The setup package also includes the facility to remote deploy a database to a data tier machine.

It always worked from my local machine and manually from the deploy machine. I never worked from the build workflow.

Read More

Code Contracts and side by side Azure 1.6 and 1.7 SDK

I have installed the latest SDK that came out this morning and I hit a compilation hurdle straight away.

My solution is starting to get to be a decent size with many third party technologies involved, Code Contracts being just one of them. My website project is failing to compile with an issue raised by the code contracts rewriter.


Read More

Updating claims within an RP session with WIF

I have a scenario where a web application is using WIF to manage federated security. The system will get a SAML token from an STS for the authenticated user. The token is only going to contain the NameIdentifier claim (a typical Windows Live token for example). This means that the application itself needs to manage the account information related to an authenticated user.

The application will store the first name, last name and email address of the user. These values will be populated into the IClaimsPrincipal for an existing account using a custom ClaimsAuthenticationManager implementation.

Read More

Should code contracts be tested?

I have been writing unit tests for my classes that use code contracts (Contract.Requires<T>) just like I did with the old style guard clauses basically since code contracts were released. My reasoning for testing them has always been that the unit test code should not make any assumptions about the implementation of the SUT and ideally should have no understanding about how it is implemented. Instead it should just test the behaviour.

If a method that takes a reference type as a parameter and a value must be supplied, then the expectation is that the method will throw an exception if null is provided. I have always believed that this behaviour should be tested regardless of whether this is implemented as a traditional guard clause, a Contract.Requires on the method implementation or a Contract.Requires on the interface or base class.

Read More