Wednesday 9 February 2011

Cannot open a TFS query in Excel

After successfully upgrading from VS2008/TFS2008 to VS2010/TFS2010 in the last few months, I today realised my machine still had an outstanding issue opening TFS queries from Visual Studio in Excel . After running the query in VS and clicking Open in Microsoft Office –> Open Query in Microsoft Excel, I was the reluctant recipient of this error message and no Excel openage:

Team Foundation Error

TF80012: The document cannot be opened because there is a problem with the installation of the Microsoft Visual Studio v10.0 Team Foundation Office integration components.  Please see the Team Foundation Installation Guide for more information.

While a number of solutions were offered, what follows is the complete set of steps I followed to fix the problem in my workstation environment (Windows Server 2008 R2 x64 with Office 2010 x86 and VS2010 RTM + TFS bits):

1. I first repaired Microsoft Visual Studio 2010 Ultimate from Control Panel. This took a while and required a restart of my workstation. All of my extensions and settings were retained (I think). On its own, this didn't fix the problem but others have reported is did for them.

2. From a command prompt running as administrator (I'm in the local administrators on my machine but that's not good enough), I re-registered the TFSOfficeAdd-in.dll. I only ran the x86 command because VS2010 is a 32-bit app and I'm running the 32-bit version of Office on Windows x64; while the same assembly exists in the 64-bit Program Files directory, I'm assuming it's for the 64-bit version of Office 2010 (just guessing):

regsvr32 "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\TFSOfficeAdd-in.dll"

3. Starting Excel from that same command window to ensure Excel started as an admin, I removed the v9.0 Team Foundation Add-In since I noticed it was showing alongside the v10.0 add-in and I wasn't sure if it was wreaking havoc. At this point, the Team menu was visible in Excel when running as admin but not when running as myself. In Excel 2010, you can manage add-ins from the File –> Options menu; click the Add-Ins tab and then choose COM Add-Ins from the Manage drop down.

4. I finally opened Excel again as myself and enabled the Team Foundation Add-In (v10.0). The Team menu now appeared in Excel.

At this point I can now open a TFS query in Excel.

Note, others have suggested deleting their Windows profile solved the problem for them, at the cost of deleting all of their settings, My Documents, etc. If you go down that path, be careful!

If you found this post helpful, please support my advertisers.

6 comments:

  1. I have exactly the same problem and haven't been able to fix it by any of these means.

    For what it's worth though, you can access exactly the same functionality from Excel via the Team Menu, with the "New List" command. The only difference is that you come at the problem from Excel rather than from Visual Studio.

    ReplyDelete
  2. Thanks! Registering the DLL fixed it for me.

    ReplyDelete
  3. This was a huge help! I had repaired my VS Team Explorer 2010 install but that didn't solve anything. Re-registering the TFS Office Add-In seems to have solved the problem. Thank you so much!

    ReplyDelete
  4. Unfortunately, none of these worked for me. But I was able to find a work around. Since I had used the command line to register my dll as an administrator, if I run VS as an administrator I am able to open my TFS items in Excel.

    ReplyDelete

Spam comments will be deleted

Note: only a member of this blog may post a comment.