信息:C#,Visual Studio 2010
我正在尝试访问现有的服务引用并且不确定如何,我可以实现以下内容以获取所有“引用”
DTE2 test = Package.GetGlobalService(typeof(SDTE)) as DTE2;
StringBuilder sb = new StringBuilder();
VSProject2 project = test.ActiveDocument.ProjectItem.ContainingProject.Object as VSProject2;
foreach (Reference item in project.References)
{
sb.AppendLine(string.Format("Name: {0}", item.Name));
}
MessageBox.Show(sb.ToString());
项目确实具有以下属性:
project.WebReferencesFolder
但它是null(是的,我确实添加了服务引用,诚实)
答案 0 :(得分:1)
查看MSDN示例中的第3个示例:
http://code.msdn.microsoft.com/vssdkwcftools
IVsWCFReferenceManager referenceManager = refMgrFactory.GetReferenceManager(hierarchy);
IVsWCFReferenceGroupCollection referenceGroups = referenceManager.GetReferenceGroupCollection();
我所追求的名称空间是 Microsoft.VisualStudio.WCFReference.Interop 在 C:\ Program Files(x86)\ Microsoft Visual Studio 2010 Beta2 SDK \ VisualStudioIntegration \ Common \ Assemblies \ Microsoft.VisualStudio.WCFReference.Interop.dll