I have VSPackage which is trying to load the issues from one of our tracking system to TFS. This package has window with
menu with options 'Filter', Import' commands. While loading main window, which calls the another function to get the current TFS project
using the below code.
m_dte = (EnvDTE.DTE)Microsoft.VisualStudio.Shell.ServiceProvider.GlobalProvider.GetService(typeof(SDTE));
m_teamFoundationServer =
(TeamFoundationServerExt)m_dte.GetObject(typeof(TeamFoundationServerExt).FullName);
m_teamFoundationServer.ProjectContextChanged += new EventHandler(teamFoundationServer_ProjectContextChanged);
but I am getting the {"Exception has been thrown by the target of an invocation."} error in below function.
private void ShowToolWindow(object sender, EventArgs e)
{
// Get the instance number 0 of this tool window. This window is single instance so this instance
// is actually the only one.
// The last flag is set to true so that if the tool window does not exists it will be created.
ToolWindowPane window = this.FindToolWindow(typeof(MyToolWindow), 0, true);
if ((null == window) || (null == window.Frame))
{
throw new NotSupportedException(Resources.CanNotCreateWindow);
}
IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
}
If I comment the TFS connection code i am able to load the main window. Is there in otherway that i can get the Current TFS project name.