Reputation: 298
I'm trying to create a Visual Studio 2012 Add-In that will be able to listen for the various TFS version control events and perform custom actions prior to or after the events.But at the time running the program shows following error
[A]Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt cannot be cast to [B]Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt. Type A originates from 'Microsoft.VisualStudio.TeamFoundation, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL
After some research ,found that Microsoft.VisualStudio.TeamFoundation.dll (version-11.0.0.0) is used it will resolve the program.But how can i add this version of dll to my project
Upvotes: 0
Views: 635
Reputation: 461
Hopefully this will be of use to someone, there are a few other threads on this topic - In Visual Studio 2012, I found that I would get a casting error if I did this:
DTE2 dte2 = (EnvDTE80.DTE2)Marshal.GetActiveObject("VisualStudio.DTE.12.0");
TeamFoundationServerExt tfsExt = dte2.GetObject("Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt") as TeamFoundationServerExt;
but it worked fine if I did this:
EnvDTE.DTE dte = Package.GetGlobalService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
TeamFoundationServerExt ext = dte.GetObject("Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt") as TeamFoundationServerExt;
I got my reference from C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.TeamFoundation.dll
Upvotes: 1
Reputation: 298
We can get reference from following path
C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.TeamFoundation\v4.0_11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.TeamFoundation.dll
Upvotes: 0