TFS delete build definition timeout

When you do a tfs delete on a build definition and you receive a timeout, you probably have to many builds in your TFS server. Even if you delete all the build for your build definition, tfs still stores all the builds in your TFS Server. Just like your TFS Team projects, you have to delete and then destroy the builds. After that, you could delete the build definition completely.

The only way to do this is, is to delete and destroy the builds in pieces. You can only do that by the command prompt.

I created a PowerShell script that loops through the builds for a specific build definition and deletes all the builds before a specific date. So if your build is maybe a year old, you could start the script a year back from now and loop through all the builds until let’s say two months ago. You could skip the number of days you want. I set the days to skip to 15 because I have a lot of builds each month and otherwise the TFS server has trouble to delete the bigger chunks.

Save the PowerShell file as “DeleteBuildDefinition.ps1” and execute it in your Visual Studio command prompt. You can execute the PowerShell file in your VS command prompt with the following command:

tfs delete build definition timeout

Looping in PowerShell forward and backwards through days

I was searching for a way for looping in PowerShell forward and backwards through days every 15 days. So I thought I would share it with you guys.

I have two different samples. Both samples have the option to specify the number of the days to skip in each loop.

The first one is counting back in days until a specific day and the second is counting forward.


Execute the command with:


Execute the command with:

Custom domain url in IIS Express with Visual Studio 2013

If your creating a web application in Visual Studio 2013 (VS2013) and run it, your site is hosted in IIS express. Your url is localhost with a random portnumber.

If you want integration with Facebook, other services or just want a custom domain in your browser then you can follow these steps.

  1. Go to the properties of your (MVC) web application
  2. Go to the web tab on the left
  3. Under Servers check the Override application root URL and fill in
  4. Hit Create Virutal Directory
  5. Change the start url above under Start Action to
  6. Go to your IIS Express settings under C:\Users\Ralph\Documents\IISExpress\config and open the applicationhost.config file.
  7. Find your site and adjust the binding<bindings>
    <binding protocol=”http” bindingInformation=”*” />
  8. Optionally add the binding for https (443)
  9. Go to your host file under C:\Windows\System32\drivers\etc and add
  10. Run your site

If you get an error. Try to run your Visual Studio instance as Administrator.

Update TypeMock version with AutoDeploy enabled

We use TypeMock in a project. We also use the TypeMock AutoDeploy feature so we can use different versions of TypeMock on one build server. The AutoDeploy feature of TypeMock makes it possible to run your unit tests on the build server without installing TypeMock on the build server. You can read about this feature in my other blog post:


Because we are using VS2013 now, we had to upgrade the TypeMock version to a new Release Candidate version that I got from TypeMock for testing. When we where testing, we saw that the tests where failing because the old version was referenced in the AutoDeploy folder. So we had to update the TypeMock version in source control to keep the AutoDeploy functionality working on the build server. After some tries, I now have a best practice for update TypeMock.


  1. Uninstall TypeMock (not always necessary but for this Release Candidate they advised me to do it)
  2. Install your new version of TypeMock (you whole team off course)
  3. Search for your AutoDeploy folder in the root of your project and check it out of TFS
  4. Open your solution and go to the TypeMock menu and choose “Fix references…”
  5. Choose the second radio button that says “Copy libraries from installation folder to:” and browse to your AutoDeploy folder of step 3
  6. Hit ok. Now every test project that uses TypeMock will be modified with the new TypeMock version. The TypeMock folder in the AutoDeploy folder now also has the new version of the dll.
  7. If some of the projects have a TypeMock references to your program files, you have to change it. This is needed because otherwise the AutoDeploy feature isn’t working. To fix this, you have to delete the reference and add a new one. Browse for the right dll to the TypeMock folder in the AutoDeploy folder in the root of your project. Repeat this for every reference in every project that has the wrong path.
  8. Browse with Windows Explorer to your TypeMock installation directory in program files. In this installation directory you will also find an AutoDeploy folder. Copy all the files in that folder and overwrite your old TypeMock version files in the AutoDeploy folder in the root of your project. 
  9. Check everything in and test your build

 When you followed these steps, you have the new TypeMock version in your project in minutes. 

How to fix the CA0053 error in Code Analysis in Visual Studio 2012

I upgraded one big Team project with a lot of different solutions (to separate stuff) to Visual Studio 2012. The custom Code Analysis gave me an CA0053 error on the build server. So I searched for the problem and came to this great blog post: How to fix the CA0053 error in Code Analysis in Visual Studio 2012. This solved my problem. I removed all the tags CodeAnalysisRuleDirectories and CodeAnalysisRuleSetDirectories. This was enough. Now Visual Studio 2012 would get the latest Code Analysis dll’s.

When queued another build, I still got the same error. This was not in all solutions so it had something to do with the solution file or with some of the projects inside it. After removing the project one at the time (after each try the build succeeded) I did a reset of the solution file so that was the same. At the end, all projects where the same and I still got the error. I then searched for a difference between solutions files.

There was the solution, the version of the file format was different and the Visual Studio version was different.


I think that I know what the cause of the problem is. Because we have a lot of different solution files (with overlapping projects in it), all the upgrades to Visual Studio 2012 where already done. Because they where already done, no file change was done so the format file version wasn’t migrated to the Visual Studio 2012 version. The custom ruleset in the projects where searching for the Visual Studio 2012 dll’s but the solution was build in Visual Studio 2010 on the build server because of the different format version.

Hopefully this fix will help someone. Let me know!


Update 11/06/2013:

We upgraded our solution to VS2013 and the Custom Code Analysis didn’t work again. So I builded the custom rules in VS2013 and used that version of the DLL. Now the clients worked again. When I started a CI build, the build failed with the CA0053 error. It seems that the build server has (in my opinion) a bug that it uses the format version of your solution file -1 to determine the Visual Studio version. Visual Studio 2013 uses the same format version as VS2012 (version 12) so you will end up with VS2012 on the build server. But because we have builded the custom rules against VS2013, the buildserver wont recognize the rules. The solution is to add the /p:VisualStudioVersion=12.0 parameter by the “MSBuild Argurments” in your CI build definition.

Typemock Settings

Embed Typemock in your TFS Build definition

When you want to test your code that uses Typemock, you can use a Team Foundation Server Build Server. The current version of Typemock is 7.4 and this version (introduced in 6.2) has the AutoDeploy feature included. This is very important because now you can use multiple versions of Typemock on one Build server. The reason for that is that you don’t have to install Typemock on you build server anymore. To setup Typemock Autodeploy, you can use the tutorial on their help page in the chapter: Typemock Isolator Integration with Team Foundation Server 2010 (TFS). The only thing that they forgot to mention in the documentation is that there is generated a Typemock directory with a couple of dll’s in it inside your just added AutoDeploy directory. This is done after you fixed the references and restarted Visual Studio. Don’t forget to checkin that directory.

In the help documentation, they say that you have to use the workflow of Typemock to get the AutoDeploy to work. The customer that I now work for already have a custom workflow. I just created that workflow last week with some custom actions for them. So I want to integrate the custom Typemock stuff in the workflow of the customer. The customer works with TFS 2010 (just migrated a few months ago from 2008 so they have a lot of catching up to do) so this blog is aimed at TFS Build 2010. But this will also work for 2012. You can also check the documentation about Typemock with TFS 2012 on their website.


The differences between the build templates

There only 4 differences between the template that are special for Typemock. I will show them beneath. The only thing that you have watch for is the right place to put custom activities on the right place.

First open your own workflow in the designer. In your toolbox, add a new category and choose the TypeMock.TFS2010.dll assembly in the installation directory of your Typemock version on your machine. After that, three custom activities are added to your toolbox. Don’t forget to reference the dll in your project where your custom workflow is located.


Now add the activities on the right place by dragging them into the workflow. You don’t have to edit any properties. On the left side, you see the default template of TFS 2010. On the right side the template of Typemock. Drag the activities on the same place in your own workflow.

Registreren Typemock

Stoppen Typemock

After that, add a workflow argument of the TypemockSettings type. You can optionally edit the Metadata argument to customize the text that you will see in you build definition.

Typemock arguments

Save your workflow and checkin your workflow. Restart Visual Studio and configure the license in your build definition.

That’s it! It’s very easy. It is not more than 10 minutes of work to edit your own template. When you run your build now with the AutoDeploy feature on and with entering the right license info in your build definition, the build will succeed en will test your Typemock tests.

VC 10.0 Runtime file failed verification with installing TFS Test Controller

Yesterday I was creating three virtual servers for a customer of me with the TFS 2010 Testcontroller and test agents installed on it. The virtual servers are all new Windows Server 2008 SP2 versions. The first thing that I had to do was (obviously) installing the TFS test controller software. So I started the ISO that the system administrator had mounted for me and started the setup. After that I clicked installing test controller software because that was needed on the first server. The setup said it would install the VC 10.0 Runtime for me and the test controller so I hit the next button. The installation started but after say 5 seconds the setup failed. I opened the setup log file and saw a weird error:


CMsiComponent::Install() expects the setup file for VC 10.0 Runtime (x86), but the file failed verification.


This was not clear for me what to do so I did a search with my favorite search engine. I saw a lot of post with a corrupted version of the Visual Studio 2010 ISO. But this was not the case because this was TFS software. So I downloaded the ISO myself again and extracted all the files. This gave me also the same error.

Then I remembered that I had this error one time before. It took me 2,5 hours of searching and trying before I remembered that… I downloaded Daemon Tools lite (mounting software) and mounted my new downloaded ISO on my new virutal DVD player. Started the setup again and now it installed within a minute. Very strange but you have to mount the ISO directly on the Windows Server 2008 server and not from a network share. I tried the solution on the other two servers (they where giving me the same error) and there the solution worked also instantly.

Hopefully I help someone with this problem or a related problem so your not searching 2,5 hours for a solution (a second time).

Use Config Transforms when Debugging your web application

Config Transforms are a great way to adjust your publish strategy. You just right click your web.config file and click “Add Config Transforms”. In that way you get the transform files of your configuration options.

In our company, we are working with a website that has multiple versions for different customers. So it is the same website only the config is changed. The config includes all kind of security settings. When we are developing we want to use the config of the specific “brand” of the website. How to accomplish this without?

SlowCheetah is a nice extension for visual studio that gives that option for WinForms projects but not (yet) for Web Applications. See the issue for this feature:


For now I found this solution:

  1. Create your transforms as you want.
  2. Create a new config file with the name web.template.config
  3. Copy everything from your web.config file to the new web.template.config
  4. Create new config files for temp for your transforms. So if you have the transforms Debug and Release, you should create temp files for them. Call them{Configuration}.config. So this would be and Place the config files in the root of your project just like your standard web.config.
  5. Copy everything from your transform files to the temp files.
  6. Add a target file to the root of your project location. Don’t do this in Visual Studio but just in Windows Explorer. Give it the following name: {Projectname}.wpp.targets
  7. Past the code beneath in the targets file.
  8. Delete your “old” web.config in Windows Explorer (not in Visual Studio)
  9. Restart Visual Studio and open your project. The solution explorer says now that you don’t have a web.config but you see the config transforms as childs. Ignore the alert that the file is missing.
  10. Rebuild your project and your done. The new web.config is generated on your drive. (if you hit refresh in the solution explorer, the alert is gone). Just change your Configuration at the top of Visual Studio and your config is changed.

Remove your web.config file from source control otherwise you will get check outs.

Config transforms for F5

SlowCheetah targets files


Contents of targets file


An optional thing that you can do is, grouping your config files beneath the template config just like that standard web.config and his transforms. The dev configs are dependent upon the template so let’s place them there. To do this is easy. Unload your project and find your dev configs. You will see something like this:

Change this in:

Repeat this for all your dev transforms. After that, save the file and reload your project.
You can also use the Visual Studio extension VSCommands. right click the files that you want to group, hit group items and select your base config file.

Internet Explorer cannot display SharePoint 2013 ODATA feed

When your starting developing in SharePoint 2013 you can use the Client Object Model (CSOM). Well this is the “old” approach of developing against SharePoint. Starting from SP 2013 you can use ODATA to develop againt SP 2013. The only thing that you have to do is to go to your SharePoint 2013 site and add _api to it. Example: http://Servername/_api

When you want to see the list available in your site you just enter lists behind it. Example: http://Servername/_api/lists

When you do that in Internet Explorer you would get the screen rendered as below.
Atom SP13

The data is there but it isn’t shown as you want. To fix this follow the steps below.

Go to internet options and change:
IE options content
IE feed render settings

When you navigate again to that page (F5 won’t work), the ODATA is shown like this now: