进出口寻找一种方式来从plugincode内自动打开源代码控制管理。 到目前为止,我设法通过执行命令打开它
View.TfsSourceControlExplorer
然而,这似乎并没有接受任何参数。
我的目标是做这样的事情:
destination = "$/dev/framework/someFolder";
_dteObject.ExecuteCommand("View.TfsSourceControlExplorer", destination);
这将他们展示我的源代码控制管理在指定的目标。
使用下面的代码来显示源代码控制管理在指定的目标:
public void SelectFolder(string path)
{
dte.ExecuteCommand("View.TfsSourceControlExplorer");
Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExplorerExt explorer =
GetSourceControlExplorer();
if (explorer != null)
explorer.Navigate(path);
}
private Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExplorerExt GetSourceControlExplorer()
{
Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt versionControl =
dte.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt") as
Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt;
if (versionControl == null)
return null;
return versionControl.Explorer;
}
为了anwser CSharpie的评论:
也有似乎是一个错误,如果调用浏览到同一目录下的文件资源管理器目前在,一切都将消失。
我有同样的问题,得到了解决此两种方式:
- 从路径截断的文件名,只浏览文件夹。
- 导航第一根(“$ /”),然后导航到你想要的文件。
在VS2013无论工作正常。
而感谢的SourceControlExplorer不是打开时“Application.DoEvent()”解决。
我认为这是不可能的。 源资源管理器检测到的团队项目,而您的团队项目节点的根。 $ / MyProject的/ ..
高兴被证明是错误的就这一个...
文章来源: Visual Studio Command for going to a specific item in source control explorer