![](/img/trans.png)
[英]How do you organise a Java solution into multiple projects, like in Visual Studio?
[英]Visual Studio Extensibility, How do you enumerate the projects in a solution?
只是想加快SDK的速度......
所以,我創建了自己的工具窗口....
現在我想迭代當前加載的解決方案中的現有項目,並在工具窗口中顯示它們的名稱....
但不太確定枚舉項目的最佳方法是什么? 任何線索?
請查看Microsoft的此代碼 :
static public IEnumerable<IVsProject> LoadedProjects
{
get
{
var solution = _serviceProvider.GetService(typeof(SVsSolution)) as IVsSolution;
if (solution == null)
{
Debug.Fail("Failed to get SVsSolution service.");
yield break;
}
IEnumHierarchies enumerator = null;
Guid guid = Guid.Empty;
solution.GetProjectEnum((uint)__VSENUMPROJFLAGS.EPF_LOADEDINSOLUTION, ref guid, out enumerator);
IVsHierarchy[] hierarchy = new IVsHierarchy[1] { null };
uint fetched = 0;
for (enumerator.Reset(); enumerator.Next(1, hierarchy, out fetched) == VSConstants.S_OK && fetched == 1; /*nothing*/)
{
yield return (IVsProject)hierarchy[0];
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.