Remove mapping between TFS and Project Server with empty Project (deleted Gantt)

As TFS admin I was asking to synchronize TFS with Project Server. There is nothing really special and MSDN is full of articles and guides about it.

But, what MSDN doesn’t say you is that if you had mapped a project on EPM with a team project on TFS and then you have deleted the project from EPM, you would experienced a lot of pains! You are not able to edit the synchronization system and, if you run the “TfsAdmin ProjectServer /GetMappedProjects” command, it will return you something like “Enterprise project  is mapped to team project XXX” where XXX is not an issue (it is the team project name) instead the big issue is the blank space between words “project” and “is”!!!

So, first piece of advice: never delete a project from Project Server without having unmapped it from TFS before.

But, what if someone else has deleted it without having unmapped it? Well, Microsoft doesn’t give you any solution and googling for it I didn’t find anything. Anyway, after having spent several months on it, I have found a solution.

But please attention: it is not a recommended solution by Microsoft: it is a my personal solution and it worked for me; anyway it could be really dangerous, so use it carefully and only if you are absolutely confident you are able to do it.

  1. Connet to the TFS Collection database (the name should be something like “Tfs_<CollectionName>”)
  2. Query table named “tbl_sync_mappings”: it should contain only one record
  3. You need to extract field named “mapping”: it contains an xml string; copy it in a text editor
  4. If you analyze the xml, you could find several useful infos but what you need is the “tpcProject” set of items: it contains on “psProject” item for each mapped EPM project!
  5. Compare this set with the output of the “TfsAdmin ProjectServer /GetMappedProjects” command and you will discover the deleted EPM projects. (If you want, you can query the MSP_Projects table inside ProjectServer_Published database with the id field of the “psProject” element to be sure that you are going to cut off the right one)
  6. So, what you need to do is simply eliminate the “psProject” element of “ghost” project and update the “tbl_sync_mappings” table: pay attention to not put any strange characters or space inside the xml!
  7. Et voilà, that’s all! Now run the “TfsAdmin ProjectServer /GetMappedProjects” command again and you will not see your deleted project anymore…

 

 

 

KB2750149 causes problems on HTTPS connections behind TMG proxy/firewall

I’ve been experiencing a lot of troubles authenticating to Team Foundation Server of my company for five months, and today I’ve finally got the cause of them and the solution.
Our TFS is installed on a Windows Server 2012 and published over HTTPS and we can get it through a TMG 2010 proxy/firewall.

Some months ago we migrated our old TFS 2010 to the new version and at the same time, some clients from Windows 7 to Windows 8: it was when we started having those problems!
If we tried to connect to it using Visual Studio 2012 we received the strange error: “TF30063: You are not authorized to access [project]”.
What’s this?!? I was using the TFS admin credentials!

I fought against it for a long time trying a lot of solution from the web but none of them solved the issue:

  • Someone suggests to clear the IE cache.
  • Someone suggests to modify settings on IIS
  • Someone suggests to install TMG client
  • Someone suggests to clear credentials saved in Credential Manager
  • Someone suggests to add TFS website to Intranet zone on IE
  • I’ve installed and uninstalled several times Team Explorer 2012 and 2010

None of them fixed the problem. Anyway last week I got the right way and today I’ve finally solved it: the issue is related to the KB2750149. This update has some known issue with the Failover Cluster Server fixed by the KB2803748…and now we’ve found another one!

After having uninstalled this update and restarted my pc I was able to connect to TFS again. Unfortunately this is a very important update solving several issues about .NET framework 4.5, so be very careful before uninstalling it!