But it works on my PC!

The random thoughts of Richard Fennell on technology and software development

TFS 2010 RC –> RTM upgrade problem with the warehouse

I recently did an in-place upgrade of a TFS 2010 RC  to RTM box. All appeared to be going fine, all the verification in the upgrade wizard passed, but when I hit configure the first step failed. It said there was a missing  dbo.sysobjects in the warehouse DB. I then had to resort the configuration DB as it was partly upgraded to try again as the DB was left partially upgraded.

I got round this problem by telling the upgrade to ignore the reporting side of TFS. The upgrade completed without issue. I was then able to re-add the reporting via the TFS administration console (optional configuration of features in 2010 is really useful!). I actually chose to recreate the warehouse DBs anew to make sure I was bringing over no corruption. Once TFS had rebuild all the DBs and cubes all was working fine.

So the technical tip: if upgrading TFS 2010 and you are getting a problem with the reporting sub system, consider bypassing the upgraded and just rebuilding that system when you are finished

[Update 19th May 2010] 

Saw the problem again today on another site going a RC->RTM upgrade. the exact error message you get is

Exception Message: TF255356: The following error occurred when configuring the Team Foundation databases: Error occurred while executing servicing step Upgrade Warehouse for component Tfs2010WarehouseBeta2ToRTM during Tfs2010Beta2ToRTM: Errors in the metadata manager. The dimension with the name of 'Work Item Tree' already exists in the 'Tfs_Analysis' database.

TF246064 upgrading TFS 2010RC to RTM

I have a basic installation of TFS 2010 running on my Windows 7 laptop. This is really useful for testing build customisation and the like, a great new feature for 2010. Today I got around to trying to upgrade it from RC to RTM, but on the verification test I got the error

[ Configuration Database ] TF255407: An error occurred while attempting to validate the configuration database. Error message: TF246064: No database could be found for the following host: TestCollection. The host has the following ID: eaf3c572-8657-4268-9852-3d73a799cdf5. To fix this problem, use the TFSConfig RemapDBs command-line tool and make sure that you specify the SQL Server instance that contains this database.

Turns out I had been a bit stupid. I had created a couple of test team project collections (TPC) whilst testing some attach/detach scenarios for a client. I deleted the underlying SQL DBs, but not deleted the TCP in TFS, I guess as part of some test, but for the life of me I cannot remember why.

So as the error message suggested I tried to run the TFSConfig command

C:\Program Files\Microsoft Team Foundation Server 2010\Tools>tfsconfig remapdbs /sqlinstances:Typhoon\sqlexpress /databaseName:typhoon\sqlexpress;TFs_configuration
Logging sent to file C:\ProgramData\Microsoft\Team Foundation\Server Configuration\Logs\CFG_CFG_AT_0504_090019.log
Command: remapDBs
TfsConfig - Team Foundation Server Configuration Tool
Copyright (c) Microsoft Corporation. All rights reserved.
The Team Foundation Server configuration could not be reconfigured. The following errors were encountered:

TF246064: No database could be found for the following host: test1. The host has the following ID: 4e9b737a-b666-48f4-9411-20249aed7ae0. To fix this problem, use the TFSConfig RemapDBs command-line tool and make sure that you specify the SQL Server instance that contains this database.
TF246064: No database could be found for the following host: TestCollection. The host has the following ID: eaf3c572-8657-4268-9852-3d73a799cdf5. To fix this problem, use the TFSConfig RemapDBs command-line tool and make sure that you specify the SQL Server instance that contains this database.

So the same error as the upgrade wizard. I also tried detaching and deleting the TCP, but got:

C:\Program Files\Microsoft Team Foundation Server 2010\Tools>tfsconfig collection /delete /collectionName:TestCollection
Logging sent to file C:\ProgramData\Microsoft\Team Foundation\Server Configuration\Logs\CFG_TPC_AT_0504_090828.log
Command: collection
TfsConfig - Team Foundation Server Configuration Tool
Copyright (c) Microsoft Corporation. All rights reserved.
Could not find file 'C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\Web Services\web.config'.

But this failed as I had already removed the 2010RC instance, so there was no web.config to read.

So what to do?

I opened SQL Management Studio and connected to my local SQL instance, open the Tfs_Configuration DB and found the tbl_ServiceHost table. I then removed the rows that referenced the TPC that had I deleted the DB for. Of course I had made sure I had a backup of the DB before I started.

Once this was done the upgrade wizard passed verification and completed without error.

Now I would not recommend this as a good way to work, but it did get me out of a hole. In my case it was only a test system so if I lost it, it was not that important. However it is good to know there is a reasonably simple solution address problems with missing TPC DBs

Technical Tip: Make sure all your TPCs are valid before you start the upgrade process, so you don’t see this issue in the first place!

Useful tool to move Reporting Services reports between servers

When you are moving TFS contents around between servers, as many people will be doing as they implement new 2010 servers and want to make use of Team Project Collections; you often have to move Reporting Services reports. In many cases you find people have lost their customised .RDL files they uploaded in the first place, and don’t want to restore the whole Reporting Services DB.

So how to extract an RDL file from a Reporting Services instance and moving it to a new Reporting Services instance?

Well have a look at Reporting Services Scripter, make makes the process fairly straight forward.

Error running Ivonna tests with ASP.NET 4

When I tried to run a working Ivonna test, previously targeted at .NET 3.5, against .NET 4 I found my test failing with the error

------ Test started: Assembly: Webpart.Tests.dll ------
<html><body>Bad Request</body></html>
Setup information
Physical Web path: C:\Projects\Test\TypeMockSample\TestWebSite
Actual path: C:\Users\fez\AppData\Local\Temp\Temporary ASP.NET Files\root\156567f2

Turns out that the fix to simple, you have to use an absolute path i.e. the / in front of the BasicTest.aspx is vital


[TestMethod, Isolated]
        public void LoadWebPage_HelloWorldWebPart_NoError()
            TestSession session = new TestSession(); //Start each test with this
            WebRequest request = new WebRequest("/BasicTest.aspx"); //Create a WebRequest object
            WebResponse response = session.ProcessRequest(request); //Process the request
            System.Web.UI.Page page = response.Page;
            //Check the page loaded

So this is a temporary work around for now, for me it is not an issue having to use a absolute path. I understand from the writer of Ivonna that this issue will be further investigated now that .NET 4.0 has RTM’d

TF30046 Error when trying to create new team project collection using an existing empty DB

I my previous post I discussed how the DB label was not used for TPC Dbs in 2010. As I was working on a setup where a central SQL box was the DT for two virtualised TFS AT instances, I therefore needed to create my TPC databases manually if I wanted TPCs of the same name on each TFS instance.

I won’t go over the old post again, but in essence I was trying to create a TPC with the name ABC on a TFS instance with a database label of RC. So I tried to create the DB TFS_RC_ABC manually and pointed the TPC create process at this. It passed the verify but I then got a

TF30046: The instance information does not match

error during the core stage of the TPC creation. Basically the empty DB was found and used, but the wizard checking on the IDs of DB and the TPC found they don’t match.

It seems  the name of the DB is the problem for pre created DBs.  I tried altering the prefix from TFS_RC, changing to just RC_, removing the _,  and eventually all the prefix, but to no effect. However, when I altered the end of the DB name so it did not match the collection name it worked

So the workaround is if I create an empty DB called ABCRCTFS,  create a collection called ABC (using ABCRCTFS as the empty DB) all seems to be OK, including that all the URLs for the collections and SP sites include the name ABC, it is just the DB has an unexpected name.

I will post again if I get a better solution or and explanation in the future.

Mixed mode assembly is built against version 'v2.0.50727' error using .NET 4 Development Web Server

If your application has a dependency on an assembly built in .NET 2 you will see the error below if you try to run your application when it has been built in.NET 4.

Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.

This can be important in VS2010 testing, as test projects must be built as .NET 4, there is no option to build with an older runtime. I suffered this problem when trying to do some development where I hosted a webpart that make calls into SharePoint (that was faked out with Typemock Isolator) inside a ASP.NET 4.0 test harness

The answer to this problem is well documented, you need to add the useLegacyV2RuntimeActivationPolicy attribute to a .CONFIG file, but which one? It is not the web.config file you might suspect, but the C:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0\WebDev.WebServer40.exe.config file. The revised config file should read as follows (new bits in red)

<?xml version="1.0" encoding="utf-8" ?>
  <startup useLegacyV2RuntimeActivationPolicy="true">
            <supportedRuntime version="v4.0" />   

    <generatePublisherEvidence enabled="false" />

Note: Don’t add the following <supportedRuntime version="v2.0.50727" />  this cause the web server to crash on start-up.

TFS 2010 Database Label not use for Team Project Collection DBs

Found out something I did not know today, the TFS 2010 database label is only used for the server’s own primary configuration databases not for the DBs for the TPC it creates.

For example on a 2010 RC install with the database label was set to RC during the installation. When I try to create a new TPC (called ABC) it tries to create a Db named TFS_ABC, even though the database label for TFS server can be seen to TFS_RC_  on the admin console and the instance’s primary databases are called TFS_RC_Configuration, TFS_RC_Warehouse and TFS_RC_Analysis.


I would have expect the new db to be call TFS_RC_ABC.

This can become interesting if like me you are working with a number of TFS instances that all share the same central SQL server instance. So if you want a TPC of the same name on two or more TFS servers that share a DT you must manually create the empty DBs to avoid a name clash.

So not a major issue but confusing if you don’t know it is a problem.


A fix to run Typemock Isolator inside the Page_Load for an ASPX page on VS2010/.NET4

I recently tried to use Typemock Isolator inside a ASP.NET page load event, to fake out some SharePoint SPLists e.g.

protected void Page_Load(object sender, EventArgs e)
     SPSite fakeSite = Isolate.Fake.Instance<SPSite>();

This has worked in the past but using VS2010RC and Isolator it failed.

  • If running VS2010 as Admin I got the error "Could not load file or assembly 'TypeMock, Version=0.12900.25133.13153, Culture=neutral, PublicKeyToken=37342d316331342d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"TypeMock, Version=0.12900.25133.13153, Culture=neutral, PublicKeyToken=37342d316331342d"}"
  • If running as a non admin user I got the error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

Typemock Support told me that I needed to edit the Typemock Isolator’s namespaces.dat file (in its programs directory), this is the file that lists valid test runners. I needed to add WebDev.WebServer40.exe to this file as this is program that makes the call to Isolator to do the faking.

So this is an immediate fix, it is unclear at the moment if this filename WebDev.WebServer40.exe will be the final one for the RTM of 2010, so be prepared for another edit in the future.

TF254024 error when upgrading TFS 2010 Beta2 to RC

Whilst upgrading a single server instance of TFS 2010 Beta2 to the RC I got a TF254024 error. This occurred at the point in the upgrade wizard where it tries to list the databases available to upgrade.

The reason for the error was the account I was logged in as (the domain administrator in my case) did not have rights on the SQL instance to see any TFS DBs. Once this was sorted, by granting owner rights to all the TFS DBs, all was OK.

I think it had got into this state as this was a ‘standard’ TFS install using an automatically installed SQLExpress instance; so rights had not been explicitly assigned during the TFS setup. By installing SQL 2008 Management Studio Express and logging in as the servers local administrator I was able to grant the rights needed.

VHD boot and c00002e2 Errors

For some reason that is beyond me now I did not setup my Lab Manager test system to be a VHD boot. So before installing the 2010 RC version I decided to P2V this system (on the same hardware) to make backups easier whilst testing. All seemed to go well

  1. I used IMAGEX to create a WIM of the disk
  2. Created an empty VHD
  3. Used IMAGEX to apply the WIM to the VHD
  4. Formatted the PC with a default Windows 7 install
  5. Added a VHD boot Windows Server 2008R2 to the PC, tested this all booted OK
  6. Replaced the test VHD with my own and rebooted

…. and it just went into a reboot cycle. Pressing F8 and stopping the reboot on error I saw I had a “c00002e2 Directory Services could not start” error. I managed to get into the PC by pressing F8 and using the AD recovery mode (safe mode did not work). After much fiddling around I eventually noticed that my boot drive was drive D: not C: as I would have expected. My VHD and parent drive had reversed letter assignments. So when the AD services tried to start they look on the parent Windows 7 partition (C:) for their data and hence failed.

I think the root cause was the way I had attached the empty VHD to used IMAGEX. I had not done it using WINPE, but just created in my Windows 7 instance and attached the VHD as drive D: before copying on the WIM

So my revised method was

  1. I used IMAGEX to create a WIM of the disk (actually used the one I already had as there was nothing wrong with it, which was a good job as I had formatted the disk)
  2. Formatted the PC with a default Windows 7 install
  3. Added a VHD boot Windows Server 2008R2 to the PC, tested this all booted OK
  4. Copied my WIM file to the same directory as my newly created W2k8R2.VHD
  5. Copied IMAGEX to this directory
  6. Booted of a Win7 DVD
  7. Pressed Shift F10 to get a prompt at the first opportunity
    1. Ran DISKPART
    2. Select Disk 1
    3. Select Part 1
    4. Detail Part – this was the 100Mb system partition Windows 7 creates and was assigned as drive C: (note when you boots Windows 7 the drive letters get reassigned just to confuse you, as to look at this you would expect your Windows 7 boot drive to be D:)
    5. Assign Letter = Q – this set the system partition to be drive Q, but any unused letter would do
    6. Select vdisk file:d:\vhd\w2k8r2.vhd
    7. attach vdisk – this loaded the VHD and assigned it the letter C: as this was now not in use
    8. list disk
    9. Select disk 2
    10. Select Part 1
    11. detail Part – checked the drive letter was correct
    12. I then exited DISKPART and from the same command prompt ran IMAGEX to put the WIM on this new drive C:
  8. Rebooted and it worked

So the technical tip is make sure your drive letter assignments are what you think they are, it may not be as obvious as you expect.