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

Follow up to last nights session on mocking

Thanks to everyone who came to my session at NxtGen in Southampton last night, and congratulation to the people who won Typemock Isolator licenses kindly provided by Typemock.

The session was meant to be based on TDD and Mocking, quite a big subject for 90 minutes. I of course had to gloss over some areas that are interesting around the edges of this subject. As I mentioned there are videoes of related sessions on this blog; also here are links on other subjects I touched on…

The community – a route to free training

I presented last night at the West Yorkshire BCS and received a number of comments that it was great to see free training being available. This for me is one of the most important areas of our community, and an area we are very lucky with. There are plenty of opportunities to access knowledge…..

Of late we have seen that the big vendor conferences (such as Microsoft’s TechEd, PDC and MIX) and the platform independent developer conferences (such as NDC) streaming their sessions live for free and also have their sessions available for free download within a few days. Microsoft’ Channel 9 is also an excellent resource of conference sessions and specially made material on a vast range of subjects from language design to scheduling of the buses on Microsoft campus. Or if you prefer to listen to something whist your drive why not try the .Net Rocks podcast. There are plenty more specialist resources out there on the web.

At the national level in the UK we also have vendor events such as Microsoft UK Techdays, and company run events like my company’s Black Marbles free events.

Outside company structures we have community events like DDD (general .NET interest) and SQLBits (SQL specific). These are free community run conferences where the members of the community submit session ideas, these are voted for by the community and a free Saturday conference is run using usually the  20 most popular sessions. Again, increasing some of these sessions are videoed and made available on the web.

At the even more local level there are always usergroup. In Leeds we have the BCS, Agile Yorkshire, Leeds SQL Usergroup, GeekUp and more I am sure I have not heard of. This pattern is reflected across the OK, it is just a matter of searching to see what is near you.

So there is no excuse for not trying to keep up to date, whether you want to learn via the web or in person. Why not have a look?

Solution to ‘Missing requirement: Shared profile 1.0.0.1308118925849’ error when installation TEE SP1 on Eclipse Indigo

During my new laptop build I have had to reinstall Eclipse, so I took the chance to upgrade to the Indigo release. When I tried to install the TFS 2010 Team Explorer Everywhere SP1 plug-in I got the error

Cannot complete the install because one or more required items could not be found.
  Software currently installed: Shared profile 1.0.0.1308118925849 (SharedProfile_epp.package.java 1.0.0.1308118925849)
  Missing requirement: Shared profile 1.0.0.1308118925849 (SharedProfile_epp.package.java 1.0.0.1308118925849) requires 'org.maven.ide.eclipse [1.0.0.20110607-2117]' but it could not be found

This stumped me for a while, but after a bit of searching on Eclipse forums I found this was a problem common to installing other plug-ins, not just TEE, so not a TEE dependency as the error suggests.

The issue was you have to be running Eclipse as an administrator to install the plug-in. Judging from the forums this has tripped a few people up with plug-ins on the Indigo release, seems this was not the case with the previous releases such as Helios.

Once you have installed the plug-in as administrator you can restart Eclipse in standard mode and connect to your TFS server as you would expect.

Lenovo W520 – one week on

I have had my Lenovo W520 a week now and must say I am very happy with it. I am still hitting the wrong keys a good deal of the time, the only problem being the Fn and Ctrl keys are reversed in position from my old Acer, it is a good job Fn-V and Fn-C does nothing dangerous!.

The keyboard is very nice to type on, a far more solid feel than any previous laptop I have had.

The performance is great, but you would expect it to be good with an Core i& and 16Gb.

But the most impressive thing has been the battery life, a good five hours even running a TFS instance on Windows 7 and having VS2010 and Office open as I do most days. I had not expected that, the battery extender bits seems to do the job very well.

So all in all very happy, seems an excellent desktop replacement, I just need to find the time to get a lab management demo rig onto it to check it out in really bit load.

Moving a VHD boot disk to Hyper-V

I have just replaced my old Acer laptop with a rather nice Lenovo W520. This has plenty of memory and is able to run Hyper-V. In the past for TFS demos I had used boot from VHD to boot the Acer into Windows 2K8, as the Acer could not run Hyper-V due to lack of hardware virtualisation support in the bios. So I had a fully configured VHD boot what I wanted to move to Hyper-V.

My first though was I could just use the P2V system build into SCVMM. I ran the wizard, connected to my VHD booted Acer laptop, provide the details asked for and all looked good until the last screen when I got the error

Error (13256):
The disk with index 1 on source machine 192.168.100.30 is an attached virtual hard disk. This configuration is not supported for physical-to-virtual conversions.

image

So that was a non starter.

So I just copied the VHD to my new Hyper-V server and created a new Hyper-V VM using it. However, when I tried to boot this it said I had no boot sector. When you think about it this not unreasonable as this VHD was always booted off my laptops primary disk boot partition. The process to fix this was as follows (thanks to Rik for some help here)

  1. Mount the VHD directly onto my Windows 2K8 Hyper-V host via the Disk Manager in the admin tools.Don’t bother to assign a drive letter.
  2. Select the Windows 2K8 partition on the VHD and shrink it by 110Mb, this is to create space for the boot partition (I suppose you could use a VHD resizer tool, but that would be slower from my experience as this rewrites the whole VHD, the shrink is very quick)
  3. In the new gap, create a simple partition and format as NTFS with the same ‘System Reserved’
  4. Dismount the VHD
  5. Start the Hyper-V VM using the edit VHD, you will still get the no boot device error
  6. Attach a Windows 7 DVD ISO and restart the VM, it should boot into the Windows setup. On the first screen press Shift F10 to get the command prompt.
  7. You should be on drive X: and see a drive C; (your old VHD partition) and D: ( the newly created one)
  8. Run the command bcdboot c:\windows /s d: to create the boot partition
  9. Load diskpart and (probably) the following commands
    • select the VHD disk – sel disk 0
    • list the partitions – list part
    • select the new partition – sel part 2
    • make it active – active
    • exit distpart
  10. As a check you can run the command bcdedit to see that it added something (this command would have returned nothing prior to bcdboot being run)

You should now be able to restart the VM and it should boot using the installed Windows 2K8 partition. As it has changed hardware it will probably want to reboot a few times as drivers are updated.

Speaking at usergroups in Leeds and Southampton

Next week I am speaking at:

The West Yorkshire BCS on “Application Lifecycle Management – supporting the software development process from inception to retirement” , Wednesday 20 July 2011, 6.30pm (refreshments available from 5.45pm) at NTI Leeds, Old Broadcasting House, 148 Woodhouse Lane, Leeds, LS2 9EN.

and

NxtGen Southampton on “TDD & Mocking, a love affair”, Thursday, July 21, 2011 , 7pm,  St Andrew's Hall, Avenue St Andrew's URC, SOUTHAMPTON, SO17 1XQ

Maybe see you at one of these events, but given the distance between the venues I doubt it will be at both!