If you have extended Team Explorer 2012 through your Visual Studio extension, I am sure you would have referred code from this article. The code in that article provides you all the necessary infrastructure to quickly integrate your extension with Team Explorer in Visual Studio 2012. However, with Visual Studio 2013 RC released, you will face an issue if you use the same base project to migrate your extension to Visual Studio 2013. So, in this blog post I will let you know what is the issue you will encounter, cause for it and how to resolve it.

Issue

“InvalidCastException error in GetService method”

Additional information: Unable to cast object of type Microsoft.VisualStudio.Services.Integration.ContextManager to type Microsoft.TeamFoundation.Client.ITeamFoundationContextManager

image

Cause

The project is referencing Visual Studio 2012 assemblies.

Resolution

Refer to Visual Studio 2013 assemblies

  1. Remove the following assembly references from the TeamExplorerIntegration project.

image

  1. Refer to the Visual Studio 2013 assemblies. The above three assemblies are present in below path

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies

[Update] For detailed steps on how to upgrade Visual Studio 2012 extension to Visual Studio 2013, please refer my friend Tarun’s great post.

Related Posts

About Utkarsh Shigihalli

Utkarsh is passionate about software development and has more than 11 years of work experience. He has developed numerous extensions for Visual Studio and Visual Studio Team Services. He is currently working as a Consultant in the United States.