But it works on my PC!

The random thoughts of Richard Fennell on technology and software development

Fixed numerous issues with VS2008 using a /resetskippkgs

I am doing some work on VS2008 at present and I when I started my VS2008, which I had not used for a while, I was plagued by errors along the lines of "The operation could not be completed". These occurred when running major features such as:

  • Loading LINQ to SQL Designer
  • Running the SQL 2008 Project Wizard

The fix turned out to be resetting the package skip loading flag. It seems a number of add-ins were not being loaded on startup. This command is run from the "Visual Studio 2008 Command Prompt" by typing

devenv /resetskippkgs

I also had problems trying to run tests using the standard Microsoft Test tools within Visual Studio. I got the error “Exception has been thrown by the target of an invocation”, but running tests using TestDriven.NET worked fine. This problem was not fixed with the /resetskippkgs. However, turns out it is a known issues if VS2008 SP1 and TFS, KB980216. The quick fix is to make sure I was connected to a TFS server. Once this was done the test could be run. There is a hotfix, but I can live without I think for now.

So the moral is, even if you don’t use an IDE everyday you can still break it with all the patching you do around it for other IDEs and underlying frameworks. A reset to defaults can often by just the kick it needs to get it working.

TF30040 error when attaching a team project collection

Whilst doing some tidying on a multi-server TFS 2010 system I needed to move a team project collection from one Application Tier (AT) to another. Both ATs (which were not a load balanced pair) shared the same SQL server data tier (DT). It should have been easy using the TFS Administration Console.

I backed up the TPC database using SQL Management tools, the TPC was then detached without any issue from the first AT. I then backed up the SQL DB again in the detached state.

I then I tried to attach the TPC on the second AT. I entered the SQL DT instance name to get a list of TPCs available for attachment and I got the error

TF30040: The database is not correctly configured.
Contact your Team Foundation Server administrator.

So I went back to the original AT and tried a re-attach and got the same error message. Strange I had not changed accounts, the TFSSetup account in use had enough rights to detach the collection but not list one to be attached, strange!

A quick chat with the DBA found the problem, the TFSSetup account in use on both ATs had had its rights trimmed on the SQL server since the system was installed. As soon as it was granted admin rights to the SQL server all was fine with the listing TPCs available for attachment and the actually attaching the TPC on the new server.

Though I did not try it I suspect that as soon as I had the list of available TPCs in the TFS Administration Console I could have removed the extra SQL rights. The TFSService account would be doing the actual attachment, as it had done the detach, the TFSSetup account only need to be used to list the available TPCs.

Microsoft.Jet.OLEDB.4.0' provider is not registered on 64bit IIS7 server

When loading an ASP.NET 3.5 web application that has been compiler for Any CPU onto an IIS7 server I got the error

The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.

This was because the server was running a 64bit OS and only the 32bit Access Driver was installed. The quick fix to get this running was to enable 32-bit applications on the AppPools advanced settings.

image

My experiences getting started with writing custom adaptors for TFS Integration Platform

The TFS Integration Platform is an ALM Rangers project that provides an excellent set of tools to migrate or synchronise source code and/or work items between different TFS servers or TFS server and third party platforms. For many people the supported release on Code Gallery will do all they need. However if you have a need to connect to a system that there is no adaptor for you need the Codeplex version so you can write it yourself. To get the environment up and running, not unsurprisingly, the best place to start is the Getting Started documents.

I did this, I got all the pre-requisites (or so I thought), I download the code and unpack the zip. I ran the  extract_tfs_assemblies.bat to get the local copies of the TFS API assemblies and loaded the MigrationTools.sln in VS2010.

First thing I noted was that I was asked to convert the solution and project files to 2010 format, though they appeared to be the right format to start with. I did this but the report showed no changes, strange!

On loading the solution, other than the ‘TFS offline’ dialog the instructions mention, it also reported it could not load the InstallationCS.csproj file because

C:\Projects\ITIS\IntegrationPlatform\Setup\InstallationCA\InstallationCA.csproj(133,3): The imported project "C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.5\Wix.CA.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

The Wix directory for the current distribution is C:\Program Files (x86)\MSBuild\Microsoft\WiX\v3.x, a quick edit of the InstallationCA.csproj in notepad to correct the path fixed this load problem (wonder if that was why VS2010 though it needed to do a solution upgrade?, I could not be bother to roll back to find out.)

I then tried to build the solution, and got around 150 errors, starting with the error

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(292,5): error MSB8009: .NET Framework 2.0/3.0/3.5 target the v90 platform toolset. Please make sure that Visual Studio 2008 is installed on the machine.

I checked and this targets file was there. I had VS2010 and VS2008 installed what could be the problem?

Well it turned out that though I had VS2008 installed I had (for some strange reason lost in the mists of time) not selected the C++ components. Easy to fix you would think. Just go into control panel, into installed products and add the missing features, so I tried to add C++ and got the message

A selected drive is no longer valid. Please review your installation path settings before continuing with setup

I tried inserting DVDs, mounting ISO etc. all to no avail. The found on this forum post, turns out you have to remove VS2008 SP1, add the feature and then re-patch.Once this was done I could build the C++ projects.

As a side note here, I went through this process a couple of time, the first time I also managed to get the TFS adaptor projects references a bit confused. The TFS2008 adaptor projects had ended up referencing the TFS2010 assemblies. This caused a build error due to obsolete calls. This was easily fixed by repointing the references to the copies of the assemblies the extract_tfs_assemblies.bat creates. However if you remember to run extract_tfs_assemblies.bat before opening the solution for the first time this should not be an issue, as all the right assemblies will be on the correct hint paths.

So I now had 36 build errors. The next one I tackled was

Unable to copy file "C:\Projects\ITIS\TestEnv\MigrationTestEnvironment.xml" to "..\..\..\Binaries\Debug\\Test\MigrationTestEnvironment.xml". Could not find a part of the path 'C:\Projects\ITIS\TestEnv\MigrationTestEnvironment.xml'.    MigrationTestLibrary

This  was because the file was actually missing, it is not under the Codeplex source control. This is the XML file defines the adaptors under test. You need to create it based on the test you wish to run, or that is my current understanding. To get around the error (as a start) I just set it ‘copy to output directory’ property to ‘do not copy’ – knowing I would switch this back later

I was now down to 16 errors, all related to the Subversion related projects. These requires, fairly obviously, some Subversion libraries I did not have on my PC. As I did not need to work with Subversion I could have chosen to just remove these projects from the solution, but I thought why not fix it it all. They key again was to follow the readme.txt in the Interop.Subversion project folder. You need to download and unzip the two sets of source for Subversion and Apr.

I was then left with a missing reference to SharpSvn. This I downloaded from http://www.open.collab.net/files/documents/180/2861/SSvn-1.6006.1373.zip and unpacked to the {solution root}/binaries/external/sharpsvn  and made sure the SubversionTCAdapter project reference pointed to this location.

Once all this was done all the projects in the solution built. So nothing too complex really, especially when you follow the instructions in the right order!

So to develop some custom adaptors now then……

Renaming branches in TFS2010

I recently was asked why a client had experienced some unexpected results when merging a development branch back into the main trunk on a TFS 2010 installation.

Turns out the issue was that during some tests that the both the Main and Dev branches had been renamed, and new branches of the same names created. So they had a structure like this:

$/ProjectX    
  Dev Newly created after the rename
  Main Newly created after the rename
  Old_Dev Renamed of Dev
  Old_Main          Renamed of Main

 

In TFS 2010 behind the scenes a rename is actually a branch and delete process, this meant we ended up with the new branch, but also a deleted branch of the old name. This is not obvious unless you have ‘show deleted items in source control explorer’ enabled in the Visual Studio option

image

Once you recreate a new branch with the same name as one of the old named branches this deleted branch is replaced by the newly created one, It has taken up the old ‘slot’ (see links at end).This means that when you try to do a merge the merge tools sees this recreated branch as a potential target, and so shows it in the merge dialog. With all the potential confusion that might cause.

image

So the simple answer is try to avoid renames, and especially try to avoid creating new branches in the same ‘slot’ as deleted/renamed ones.

For a more detailed explanations of that is going on here have a look at this post on renaming branches in TFS and this one on ‘slot mode’ in 2010 version.

Somewhat nasty upgrade experience with Seesmic Desktop 2

A few days ago I got the regular ‘there is a new version of seesmic’ message.

image

So I pressed update and got the less than helpful message

image

After a quick search on the web I found the log files are in C:\Users\[username]\Documents\Seesmic\Seesmic Desktop 2\Logs, why that cannot be listed on the error dialog I don’t know!.

Unfortunately there was nothing obvious in the log, just a list of plug-ins it loaded. So I went back and tried the upgrade again, reading the release notes (I know a strange idea) and noticed that it mentioned a specific version of Silverlight. A quick check of this showed I was not up to date, so I went to http://www.microsoftr.com/silverlight and ran the installer, which updated my install (I would have expected Windows Update to have done this).

I tried the update again it failed, I then remembered that IE was running and this could have blocked some of the Silverlight assembly updates so I closed all browsers down. I also deleted the Seesmic log files, so I could get a clean look at any errors. I reloaded Seesmic and was present with an updating dialog.

image

And all seems to be working, not sure which step actually fixed it!

Lets seem what the new UI is like to use……

Problems connecting a Netgear WG111 USB Wifi Dongle to a Netgear DG834GT router

Just spent an interesting hour trying to connect a Netgear WG111v2 USB WiFi Dongle to Netgear (Sky Branded) DG834GT router. They are both from the same manufacturer so you would they would work together!

This router was setup with its default Sky settings so WiFi was setup as WPA.

I installed the WG111 onto an XP laptop installed the newly downloaded V 5.1.1308 (26 Dec 2007) drivers and tried to connect. The router was spotted without problems and I was prompted to enter my WPA password, which was printed onto the bottom of the router (I had logged in to router via the web admin console to check this was correct). After what seemed like a long delay I was left not corrected to the router, but with no obvious error.

I fired up my work laptop which has built-in Wifi, this saw the router and connected as soon as the password as entered. Strange I thought, is this an XP or a WG111 problem?

I did a bit of searching and saw this was not an uncommon problem, the WG111 seems a troublesome child. In the end I got it working, this was the process I followed:

  • Via the network connection window in XP I looked at the properties of the WG111
  • On the wireless tab I switched of ‘Use windows to configure my wireless network setting’.

image

  • This allowed me to open the Netgear Wireless Assistance tools to get more diagnostics. I saw that the router was running on the same channel as another local router.
  • Via the web based admin console of the router I changed the channel to a free one, in my case 10 – However, I don’t think this actually fixed the problem.
  • Via the web based admin console of the router I changed the WiFi mode from ‘b and g’ to ‘g only’ – This is the important one I think
  • I saved the changes and rebooted the router and it all worked
  • Just to tidy up, via the network connection window in XP I went back into the properties of the WG111 and on the wireless tab I switched on ‘Use windows to configure my wireless network setting’
  • Finally rebooted the laptop just to check it all worked, it did

I suspect the issue here is the WG111 getting confused if it is in 802.11b or 802.11g network, so removing the confusion fixed the problem

TF215097 error when using a custom build activity

Whist trying to make use of a custom build activity I got the error

TF215097: An error occurred while initializing a build for build definition \Tfsdemo1\Candy: Cannot create unknown type '{clr-namespace:TfsBuildExtensions.Activities.CodeQuality;assembly=TfsBuildExtensions.Activities.StyleCop}StyleCop'

This occurred when the TFS 2010 build controller tried to parse the build process .XAML at the start of the build process. A check of all the logs gave no other information other than this error message, nothing else appeared to have occurred.

If I removed the custom activity from the build process all was OK and the build worked fine.

So my initial though was that the required assembly was not loaded into source control and the ‘version control path to custom assemblies’ set. However on checking the file was there and the path set.

What I had forgotten was that this custom activity assembly had a reference to a TfsBuildExtensions.Activities assembly that contained a base class. It was not that the named assembly was missing but that it could not be loaded because a required assembly was missing. Unfortunately there was no clue to this in the error message or logs.

So if you see this problem check for references you might have forgotten and make sure ALL the required assemblies are loaded into source control on the control path for custom assemblies used by the build controller

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.