But it works on my PC!

The random thoughts of Richard Fennell on technology and software development

Where has my mouse cursor done? Unable to record a video in Microsoft Test Manager

MTM has the feature that you can use Expression Media Encoder 4 to record the test run as a video. To enable this feature, after you install MTM, you have to install the basic version of Expression Encoder, and a few patches see notes here for a list of files and the process.

I recently did this on PC and tried to record a video. As soon as the recording process started the PC virtually stopped. It ran to 50%+ load on a dual core 2.3GHz CPU and the mouse disappeared. As soon as I stopped MTM (via task manager and the keyboard alone) it became responsive again. If I ran MTM without a video recording it was fine. Should be noted that if I ran the Expression Encoder (not via MTM) I got the same problem.

Turns out the problem was not the PC performance but the nVidia video drivers. Once I updated these to the current ones from the nVidia site it all worked as expected.

More on using the StyleCop TFS 2010 Build Activity– handling settings files

In a recent build I wanted a bit more control over rules used by StyleCop; in the past I have just tended to have the correct ruleset in the Program Files\StyleCop directory and be done with that. This time I wanted to make sure different rules were associated with different given solutions.

The StyleCop build activity does allow for this; there is a property to set the path to the settings file. In my build process template I set this property as below, via an assignment activity

StyleCopSettingsFile = String.Format("{0}\Settings.StyleCop", localProject.Substring(0, localProject.LastIndexOf("\")))

so picking up the settings.stylecop file in the solution folder, but you could use any logic you need here, or just pass the fixed path to the settings file as a build process argument.

So I placed an edited settings.stylecop in the same folder as my .SLN file under source control and ran a build. However when it ran more rules were evaluated than I had expected, in fact all the rules from the default ruleset had been used.

What I had forgotten to do was set the merge rules for StyleCop. So I opened the setting.stylecop file in the StyleCop editor (installed when you install StyleCop on the PC)

image

I then set the setting to not merge this ruleset with any other ones, and to always re-run all the results.

Once these changes were saved and the file checked back into TFS, StyleCop ran the rules I expected.

image

Where do I find the product key for Team Explorer Everywhere?

When TEE is installed you have to provide a product key if you do not wish to run it in 90 day trial mode. Those of you used to using MSDN Subscriber downloads would guess you press the Key button next to the Download button and a product will be provided. However this is not the case, all you get is the message the product does not require a key.

image

The answer is actually simple, you are just in the wrong place. You need to go back to the subscriptions menu and look in ‘My Product Keys’

image

Scroll down and you will find you TEE key in the list

image

Linking a TFS work item to a specific version of a document in SharePoint

SharePoint in my opinion is a better home for a Word or Visio requirements document than TFS. You can use all the SharePoint document workspace features to allow collaboration in the production of the document. When you have done enough definition to create your projects user stories or requirement then you can create them in TFS using whatever client you wish e.g. Visual Studio, Excel, Project etc.

You can add a Hyperlink from each of these work items back to the SharePoint hosted document they relate to, so you still retain the single version of the source document. The thing to note here is that you don’t have to link to the last version of the document. If SharePoint’s revision control is enabled for the document library you can refer to any stored version. Thus allowing the specification document to continue evolving for future releases whilst the development team are still able to reference the specific version their requirements are based on.

The process to do this is as follows..

Open your version history enabled document library, select the dropdown for a document and select version history

image

If you cut the hyperlink for the 4.0 version of the document you get an ordinary Url link  “…/BlackMarble/SharePoint Engagement Document.docx”

If you cut the hyperlink for the 2.0 version of the document you get  a Url like this with a version in it “.../_vti_history/1024/Black Marble/SharePoint Engagement Document.docx”

You can paste these into ‘Add link to requirement’ dialog as often as required

image

So there is a link to each revision of the document

image

More tips and tricks using my Typemock custom build activity with TFS 2010 build

Every time I add the Typemock Isolator custom activity to a TFS 2010 build I learn something new that eases the process. In the past I have posted on the basic process to get the activity into your build, and I would also draw your attention to the ALM rangers guide to build customisation, which provides loads of useful information on this front.

Today, when I added the activity to a build I made the following improvements to the settings to make life a bit easier. This build is one used wildcard scanning for assemblies containing test with a test configuration file (this is the red usage in the documentation, it will make sense if you read the documentation)

image

So the changes over and above the usually configuration.

  1. In the project used to edit the build process workflow I added a reference to the Microsoft.TeamFoundation.Client assembly (found in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0\Microsoft.TeamFoundation.Client.dll)
  2. This meant I could replace the hard coded TPC Url property ProjectCollection on the ExternalTestRunner activity with BuildDetail.BuildServer.TeamProjectCollection.Uri.ToString()
  3. I noticed you have to explicitly set the build definition’s configuration and platform. If you only set the target solution and let these default the test results are not published. This I suppose is a bug in the activity, but not one I am rushing to look at as I would normally set these values

So for my usage of the custom activity the properties are

image

As you can see these are nicely generic now, no project based hardcoded values

More on running multiple TFS build controllers on a single VM

I have been having a on-going project to run multiple build controllers on a single VM. Today I needed to reconfigure a on of the controllers to point at a different TPC. You have to do this the correct way to avoid problems.

My error log was full of

Http communication failure:
Exception Message: Cannot listen on pipe name 'net.pipe://build/ServiceHost/1' because another pipe endpoint is already listening on that name. (type AddressAlreadyInUseException)

It all boiled down to the fact I ended up with two controllers trying to use the same URI, in my case

vstfs:///Build/ServiceHost/1

The number at the end of this URI is assigned when the controller is registered with a TPC. If, as I did, you just stop a controller and edit its properties to point at another TPC and restart it, it is possible to end up with two controllers on the same box trying to use the same ID.

The simple fix is to unregister the build controller and the register it with the new TPC as needed. This will cause the machine to be scanned and new, empty ID chosen for the URI. As as detailed in Jim Lamb’s original post.

As a side effect I also saw errors in the log saying custom activity assemblies could not be loaded due to permission errors. This all turned out to be that the custom activities are stored in

C:\Users\[tfs build account]\AppData\Local\Temp\BuildAgent\[agent ID] 

So if two agents have on the ID, even if one’s parent controller is failing to load fully, it will tend to lock the files for the other controller. Again this was fixed by registering the controller and agents in the correct manner