But it works on my PC!

The random thoughts of Richard Fennell on technology and software development

How little do you have to do to run a VS/TFS2008 build on a TFS2010 server?

As do many people I have a good number of TFS2008 style builds for legacy applications. I will, in the end, move these over to VS2010 and hence upgrade their build formats to the new 2010 workflow based one, but for now it would be nice to be able to run them with the minimum of effort. To this end I have done some work to see the minimum I can get away with to allow these builds to run, the aim being to leave the build box as close to a virgin TFS2010 one as possible.

Basic Setup
My basic build system was

  • Windows Server 2008 32bit with SP2
  • TFS 2010 build

A VS2010 Test
Just to make sure all was OK, I created a basic VS2010 MVC2 project with it’s default tests. I then create a default build for this. This failed as my build machine did not have the targets to build a web application. I copied the directory

C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications

up from a development PC to the build box and tried again. The build still failed as it was missing MVC2 assemblies, I downloaded the AspNetMVC2_VS2008.exe installer to get these assemblies on my build box. Once this was all done the build worked and the tests passed

A VS2008 Test
So I knew I had a 2010 build system that could build and test a 2010 solution. I next took an existing VS2008 solution’s build, this build had been upgraded as part of the TFS2008->2010 server upgrade. The build failed completely. This was not surprising as as well as being for a different version of VS I knew that was missing a number of custom build tasks.

First I had to install all the custom tasks, for me this was

Once all these imports were present the build tried to compile, and failed with the error.

C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets(133,11): error MSB4064: The "Retries" parameter is not supported by the "Copy" task. Verify the parameter exists on the task, and it is a settable public instance property.
C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets(131,5): error MSB4063: The "Copy" task could not be initialized with its input parameters.  [c:\builds\Moorcroft Website\Debt Collection

I spent a lot of time fiddling here, if I replaced my

C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets

with one form my PCs V9.0 directory all was OK, but then I found this post that sugested to just removed the offending parameters in the targets file, they are just retry and timouts! Once I did this the build attempted to compile the solution (and I checked it still worked for my VS2010 MVC2 solution).

I now got another set of missing assemblies errors. This was due to the lack of MVC1 on the build box, this was downloaded and installed

So now my MVC1 web site built, but the associated test project failed. This was because the V9 of Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll could not be found, the build box had V10. To address this I changed the assembly reference in the test project from the GAC to a copy of the assembly I included under source control, so it could be pulled to the build server.

Everything now built. However the tests did not run. There was an error that MStest could not be found. I edited the tfsbuild.proj to add the path to the MSTest file

     If the RunTest property is set to true, then particular tests within a
     metadata file or test container may be specified here.  This is
     equivalent to the /test switch on mstest.exe.

    <TestToolsTaskToolPath>C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE</TestToolsTaskToolPath>

If I looked at the build log I could see that MSTest now ran, and I could see all my 100+ test, but they all failed and were not published to the TFS server. I copied the .TRX results file local from the build box and opened it in VS2010. I could then see that all the test failed because the Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll could not be seen. I am not sure it is great solution but I just dropped a copy into the same directory as MSTest.exe C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE. The other option I could think of would be to put it in the GAC.

Once this was done most of the test executed and passed Ok, but some still did not. Again checking the .TRX file, as it still did not publish the results, was due to problems with TestContext. It seems the V9 assembly passes TestContext parameters in a different way to the V10 one. The test that passed did not have any TestContext declared. So as I did not need TestContext for these tests I just commented them out.

All my test now ran, past, and the results were publish. The problem was if a test failed the results were not published, but this seems to be a know issue so nothing I can do about that now.

So I now have build that mostly work, probably well enough for now. I have not need to install VS2008 or VS2010 on the build box which is nice. Just have to see how well the build holds up in production.

TF31002: Altering the URL that your TFS 2010 Web Client uses to talk to the AT

The Web Client for TFS 2010 (what was called Team System Web Access TSWA) is now installed as a core part of the Application Tier. It is no longer a separate install as it was in previous versions. This means it is easy to implement, it is just there by default. However, this can raise some problems if intend to expose to TFS AT via a firewall to the Internet, or use an alias for your TFS AT. This is because, by default, the Web Client uses it’s host server name as the AT name to connect to, it assumes the AT is local.

So for example, if you install your AT on SERVER1 you can set the server so that it responds to calls to the name TFS.DOMAIN.COM (after suitable DNS registration and disabling of local loopback checks on the server). So all your TFS clients should be able to access the server via http://tfs.domain.com:8080/tfs. However if a user tried to access the sever via Web Client URL of http://tfs.domain.com:8080/tfs/web they will get an error that that the inferred local AT (http://server1:8080/tfs) cannot be resolved (from where they are outside the firewall.


TF31002: Unable to connect to this Team Foundation Server: https://server1/tfs. Team Foundation Server Url: https://server1/tfs. Possible reasons for failure include: - The name, port number, or protocol for the Team Foundation Server is incorrect. - The Team Foundation Server is offline. - The password has expired or is incorrect. Technical information (for administrator): The request failed with HTTP status 404: Not Found.

This is easily addressed edit the C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\Web Access\Web\web.config file and explicitly name the AT to be used for the web client. This is in the block

     <!-- <add name="
http://server:8080" /> -->

Note here the sample URL is wrong, when you are done it should look something like

  <add name=
http://server1:8080/tfs /> -

Interestingly this fixes the issue on the screen shot above for the lower instance of the error, but not, the upper one. However that is enough to get you into the client and you don’t see the error after that.

Today’s DDD South West

Thanks to everyone who turned up for my session at DDD South West, and to the organisers for putting the event on so well.

As my session was basically a 1 hour demo of the testing tools in VS2010 there are no slides for me to upload, but if you have any questions ping me an email. I would say that for a good overview of the subject have a look at the book ‘Professional Application Lifecycle Management with Visual Studio 2010: with Team Foundation Server 2010

TF50609 error when creating a new team project in TFS 2010

After upgrading a TFS 2010 RC server (which was previously upgraded from Beta1 to Beta2) to RTM I hit a problem when trying to create a new team project. The error I saw was

Event Description: TF30162: Task "GroupCreation1" from Group "Groups" failed
Exception Type: Microsoft.TeamFoundation.Client.PcwException
Exception Message: TF50609: Unable to retrieve information for action ADMINISTER_TEST_ENVIRONMENTS, it does not exist.

A quick search shows this is a known problem with TFS 2010 Beta 1 to Beta 2 upgrades, strange it did not show itself on our servers until we when to RTM. Grant Holiday provides the solution for Beta 1 to Beta 2, but the command line required for RTM is slightly different to the one he had to use. The fix involves using both the parts of this post, the TF50660 is a symptom of the underling TF237091 error

  • Make sure you have exported a good working process template from another TPC
  • Delete all the old (Beta 2 process templates) from problem TPC
  • ALSO delete the new RTM process templates, in my case MSF Agile V5 (if you don’t do this and then reload the template the witadmin edit seems to have no effect)
  • Run the witadmin command (note no /P: option that Grant mentions and it is dimension not dim at the end)

witadmin chnagefield /collection:http://myserver:8080/tfs/myprojectcollection /n:Microsoft.VSTS.TCM.AutomationStatus /reportingtype:dimension

  • Import the known good process template (if you had tried to do this before the witadmin edit you would have got the error ‘TF237091: Actual reporting settings for the field Microsoft.VSTS.TCM.AutomationStatus are different from those specified in the XML. Changing these settings is prohibited.’
  • You should now be able to create new team projects
  • You need to repeat this for each TPC you have that shows the problem

TF261007 error message when attaching a collection

Whist moving Team Project Collections (TPC) from our old TFS2010 Beta/RC server to new production hardware I got a TF261007, exactly as detailed in Marcel de Vries post. However, I was in the better position than he was as I still had full access to my original server, so I thought I could go back, re-attached the TPC on the old server, run the command

tfsconfig lab /delete /collectionName:MyCollection /External

re-detach and all would be OK.

This was not the case, you still get the same problem as TF261007. It seems that if you have a TPC what has ever been on a TFS 2010 RC server with Lab Management configured then it can only be moved to a new server that also has Lab management configured, or at least SCOM VMM console installed and pointed at VMM Host.

I checked this with Microsoft and was told it is a known issue with the Lab Management RC and will be fixed in the RTM, for now there is no other workaround other than the one Marcel detailed.

Looking for a good overview of Visual Studio 2010 and ALM?

Visual Studio 2010 provides many new features to aid Application Lifecycle Management. Learning its capabilities can be a bit daunting, especially if you are new to Team Foundation Server.

So enter the new book ‘Professional Application Lifecycle Management with Visual Studio 2010: with Team Foundation Server 2010’ by Mickey Gousset, Brian Keller, Ajoy Krishnamoorthy and Martin Woodward. This provides a great overview of all the the key features of Visual Studio and TFS 2010, presented with a view as to how TFS gives an end to end delivery of an ALM process.

Don’t go expecting this book will tell you everything about TFS, even at 600 pages it cannot be that detailed, it is a huge product, you think SharePoint is big, well it is just a subset of TFS! To address this potential problem the book contains many links of to relevant sources both on MSDN and blogs to fill in the extra detail you are bound to need concerning TFS and general development processes. Think of it as a “get you started” book, or a “what’s new in this release”, not a day to day administrators guide.

My one complaint, and it is very minor, is that it does read a bit like a collection articles as opposed to a single book. However, given it has four authors and the scope of the subject it covers this is forgivable.

So if you are are considering TFS 2010, whether as a developer, a sys-admin or manager this book will give you a good introduction into that you can achieve in your ALM process. Well worth a read.



Notes from our TFS 2010 upgrade

Got time today to start our proper internal TFS 2010 rollout. This involves linking up the new TFS to our SharePoint 2010 farm and merging in the contents from 2008 TFS and 2010 RC servers.

All went fairly well, our SharePoint farm caused a few problems with its rather nice redirection feature. This  allows you to gradually move SharePoint content from an older server to a new one. A page is requested from the new server, if it is there it is used, if it is not the content on the old server is used. This caused a couple of problems during the install of TFS that content was not on the new SharePoint server so it redirected to the old one. However, the correct response was that the content was not there and TFS need to install or configure it. Once we realised this was going on there were no major issues with the TFS 2010 installation.

So we had a nice new TFS 2010 install. The next task was to move over content from the 2008 server. Our 2008 server was virtualised so I snaphot’d it, made sure we had a good SQL backup and did an in-place upgrade, and this is where I hit a problem. Our new TFS 2010 install and the 2008 were using the same central SQL server. Our new TFS 2010 install had created a TFS_Configuration DB, I had had the option to put in prefix such as TFS_2010_Configuration but decided I did not need it. This choice came back to bite me. When you do an in-place upgrade of 2008 to 2010 it rolls up all the old TFS DBs into the new structure, creating a new DB, with you guess it, the name TFS_Configuration. If you are doing a new install you can alter this DB name, but this is not the case for a upgrade, you have to use the standard name. So I was a bit stuck. The solution was to:

  1. take my new TFS 2010 server temporarily off line
  2. rename the TFS_Configuration DB
  3. do the in-place upgrade on the new 2008 server to 2010, so it creates as new TFS_Configuration DB
  4. detach the newly upgraded Team Project Collection on the TFS admin console
  5. take my upgraded TFS 2008 server off line
  6. rename its TFS_Configuration DB (if really confident you could delete it)
  7. rename the original TFS_Configuration DB back
  8. restart the main TFS 2010 server
  9. attached the upgraded TPC in the TFS admin console

Simple really !

TF237195 error when creating a new team project

After upgrade TFS 2010 RC to RTM you might see a problem when you try to create a new team project. The creation fails with error:

Module: Engine
Event Description: TF30162: Task "Queries" from Group "WorkItemTracking" failed
Exception Type: Microsoft.TeamFoundation.Client.PcwException
Exception Message: TF237195: The following user name is not supported: [SERVER]\$$PROJECTCOLLECTIONADMINGROUP$$

The answer is simple, but I had missed it!

Make sure that you are creating your new team project from a copy of the 2010 RTM version of Team Explorer. If you use the RC version you will see the error.

TFS 2010 RC –&gt; 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.