But it works on my PC!

The random thoughts of Richard Fennell on technology and software development

Where can you learn more on Typemock after last night session at NEBytes?

Thanks to everyone who turned out from Rik’s and my session last night at NEBytes. I have not bothered uploading my slides as it was really a demo driven session, but there is a video of a similar session I did at NDC2010

However, if you want to learn more about using Typemock Isolator with legacy system why not attended Roy Osherove’s ‘Be a Legacy Code Unit Test Ninja with Typemock Isolator’ web session next week?

Also I will be doing another web session, similar to last nights, on Typemock and SharePoint on the 1st December.

0x80004004 when trying to upgrade Live Writer and Messenger

For ages now I have have been prompted when I loaded Live Writer that there was an upgrade available, and every time I tried it get it, at the end of the install it failed and rolled back. As I did not have time to dig into it I just used the older version.

Well today, due to upgrades in our LAN, I need to upgraded Live Messenger and as this is of part of the same Live Essentials 2011 package it not unsurprising I hit the same problem. A bit of experimentation showed the issues was that the upgrade was not able to remove the old version. If i tried to remove it via Control Panel it failed with a 0x80004004 error. In the error log I saw

Product: Windows Live Messenger -- Error 1402. Could not open key: UNKNOWN\Components\A49B6681220C2EA49826913B104EE03B\B55DF58AB1984134795AAE690CDB085B.  System error 5.  Verify that you have sufficient access to that key, or contact your support personnel.

A bit of web research show this seems to be related to 32/64bt issues and maybe debris from the beta version of Live Writer.

The answer was to use Windows Clean Up Utility (remember this is take no prisoners tool so use it with care) and remove all the package with the words ‘Microsoft’ and ‘Live’ in their names. Once this was done the Live Essentials 2011 installer was happy to do a new install, and it even remembered my blog settings!

Adding a Visual Basic 6 project to a TFS 2010 Build

Adding a Visual Basic 6 project to your TFS 2010 build process is not are hard as I had expected it to be. I had assumed I would have to write a custom build workflow template, but it turned out I was able to use the default template with just a few parameters changed from their defaults. This is the process I followed.

I created a basic ‘Hello world’ VB6 application. I had previously made sure that my copy of VB6 (SP6) could connect to my TFS 2010 server using the Team Foundation Server MSSCCI Provider so was able to check this project into source control.

Next I created a MSbuild script capable building the VB project, as follows

<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  
  <PropertyGroup>
    <TPath>C:\Program Files\MSBuild\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks</TPath>
    <TPath Condition="Exists('C:\Program Files (x86)\MSBuild\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks')">C:\Program Files (x86)\MSBuild\ExtensionPack\4.0\MSBuild.ExtensionPack.tasks </TPath>
  </PropertyGroup>
  <Import Project="$(TPath)"/>
 
  <PropertyGroup>
    <VBPath>C:\Program Files\Microsoft Visual Studio\VB98\VB6.exe</VBPath>
    <VBPath Condition="Exists('C:\Program Files (x86)\Microsoft Visual Studio\VB98\VB6.exe')">C:\Program Files (x86)\Microsoft Visual Studio\VB98\VB6.exe</VBPath>
  </PropertyGroup>
 
  <ItemGroup>
    <ProjectsToBuild Include="Project1.vbp">
      <OutDir>$(OutDir)</OutDir>
      <!-- Note the special use of ChgPropVBP metadata to change project properties at Build Time -->
      <ChgPropVBP>RevisionVer=4;CompatibleMode="0"</ChgPropVBP>
    </ProjectsToBuild>
  </ItemGroup>
  <Target Name="Default">
    <!-- Build a collection of VB6 projects -->
    <MSBuild.ExtensionPack.VisualStudio.VB6 TaskAction="Build" Projects="@(ProjectsToBuild)" VB6Path="$(VBPath)"/>
  </Target>
 
  <Target Name="clean">
    <Message Text="Cleaning - this is where the deletes would go"/>
    
  </Target>
  
</Project>

This used the MSBuildExtensions task to call VB6 from MSBuild, this MSI needed to be installed on the PC being used for development. Points to note about this script are:

  • I wanted this build to work on both 32bit and 64bit machines so I had to check both the “Program Files” and “Program Files (x86)” directories, the Condition flag is useful for this (I could have used an environment variable as an alternative method).
  • The output directory is set to $(OutDir). This is a parameter that will be passed into the MSBuild process (and is in turn set to a Team Build variable by the workflow template so that the build system can find the built files and copy them to the TFS drop directory).

This MSBuild script file can be tested locally on a development PC using the MSBUILD.EXE from the .NET Framework directory. When I was happy with the build script, I stored it under source control in the same location as the VB project files (though any location in source control would have done)

The next step was to create a new Team Build using the default build template with a workspace containing my VB6 project.

The first thing to edit was the ‘Items to Build’. I deleted whatever was in the list (sorry can’t remember what was there by default). I then added the build.xml file I had just created and stored in source control

image

I then tried to run the build, this if course failed as I needed to install VB6 (SP6) and the MSBuildExtensions on the build server. Once this was done I tried the build again and it work. The only issue was I got a warning that there were no assemblies that Code Analysis could be run against. So I went into the build’s parameters and switched of code analysis and testing as these were not required on this build.

So the process of build ingVB6 on TFS 2010 turned out to much easier than I expect, it just goes to show how flexible the build system in TFS 2010 is. As long as you can express your build as an MSBUILD file it should just work.

You can’t edit a TFS 2010 build workflow template with just Team Explorer installed

I tried to open a TFS 2010 build template within the Visual Studio shell (the bit that gets installed when you put Team Explorer onto a PC) and saw the error “The document contains errors that must be fixed before the designer can be loaded”.

image

At the bottom of the screen it showed that all the underling assemblies could not be found.

The solution is simple, install a ‘real version’ of Visual Studio, I put on Premium. It seems that the shell does not provide all the assemblies that are needed. Once I did this I could edit the XAML with no problems

[More] Fun with WCF, SharePoint and Kerberos

This is a follow up to the post Fun with WCF, SharePoint and Kerberos – well it looks like fun with hindsight

When I wrote the last post I thought I had our WCF Kerberos issues sorted, I was wrong. I had not checked what happened when I tried to access the webpart from outside our TMG firewall. When I did this I was back with the error that I had no security token. To sort this we had to make some more changes.

This is the architecture we ended  with.

image

The problem was that the Sharepoint access rule used a listener in TMG that was setup to HTML form authentication against our AD

image

and the rule then tried to authenticate our Sharepoint server via Kerberos using the negotiated setting in the rule. This worked for accessing the Sharepoint site itself but the second hop to the WCF service failed. This was due to use transitioning between authentication methods.

The solution was to change the access rule to Constrained Kerberos (still with the same Sharepoint server web application SPN)

image

The TMG gateway computer (in the AD) then needed to be set to allow delegation. In my previous post we had just set up any machines requiring delegation to ‘Trust this computer for delegation to any service’. This did not work this time as we had forms authentication in the mix. We had to use ‘Trust this computer for delegation to specific services only’ AND ‘use any authentication protocol’. We then added the server hosting the WCF web service and the Sharepoint front end into the list of services that could be delegated too

image

So now we had it so that the firewall could delegate to the Sharepoint server SPN, but this was the wrong SPN for the webpart to use when trying to talk to the WCF web service. To address this final problem I had to specifically set the SPN in the programmatic creation of the WCF endpoint

this.callServiceClient = new CallService.CallsServiceClient(
    callServiceBinding, 
    new EndpointAddress(new Uri("http://mywcfbox:8080/CallsService.svc"), EndpointIdentity.CreateSpnIdentity("http/mywcfbox:8080")));

By doing this a different SPN is used to connect to the WCF web service (from inside the webpart hosted in Sharepoint) to the one used by the firewall to connect to the Sharepoint server itself.

Simple isn’t it! The key is that you never authenticated with the firewall using Kerberos, so it could not delegate what it did not have.

A week with a Windows Phone 7 – It just works!

I have had my LG WP7 phone about a week now. The best thing about it, it just works. Ok I have had a few learning issues over the Metro UI, but usually the answer is so obvious I have just overlooked it. Stupid things like I was looking for the button that was equivalent to the long press on the end key on my HTC Windows 6.5 phone to lock the phone; I had not consider the off button! A classic UTS (user too stupid) error, or maybe a user dragging old habits over to a very different way of working?

The thing that has impressed me the most so far is the voice control. In the past using a voice system usually involved recorded names and phrases and tagging them to applications or people so calls can be made. On WP7 it just works, press the button say CALL FRED BLOGGS MOBILE and it dos the rest. I have not had it fail one yet, very impressive.

The main thing I dislike most is the one I expect to dislike and that is the lack of tethering, I used my old phone as 3G modem when at client sites. It was great that I could just use my standard phone voice and data package for both phone internet access and PC internet access. I tended to not use this feature every week, but when I needed it I tended to use a lot of data, but it did not matter it was just covered by a single package at no extra charge. However, now I need an extra 3G dongle, so I have to work out whether it is more cost effective to get a PAYG dongle or an extra contract.

Another minor irritant, and this is not the operating system but the electronics, is that there is no led to show if the phone is charging or low on battery. It is all shown via the main screen. At one point I let the phone go completely flat and when I plugged it into a PC via USB to charge I saw nothing for about half an hour until there was enough power to show the screen. I though the phone was broken;, a nice little led would have fixed this for me,

So thus far it is a success, far better than my old HTC Diamond2 (but I am having to keep that in the glove box of my car to do SatNav for a while until there is WP7 solution)

November Agile Yorkshire meeting “William Hill Agile Case Study”

The title of the November Agile Yorkshire meeting (on Tuesday the 9th) is "A case study exploring how agile methodologies were used to help change the way sports are traded at William Hill forever.". As usual this is a free event and is hosted at the Old Broadcasting house in Leeds starting at 6:30pm and I am sure people will go to the pub afterwards.

I have to go to Edinburgh that day to present at a Microsoft ALM event (still space available if you are in the Edinburgh area) and I doubt I will be back in time. A shame as this subject looks like a very interesting one.

For more details look at www.agileyorkshire.org