开发者

Can you access 'Service Reference' Programmatically?

Info: C#, Visual Studio 2010

I am trying to access the existing service references and am not sure how, I can achieve the following to get all 'references'

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));
 }
开发者_如何学Python
 MessageBox.Show(sb.ToString());

project does have the property:

project.WebReferencesFolder

but it is null (yes, I do have a service reference added, honest)


Check out the 3rd Example from the MSDN Sample:

http://code.msdn.microsoft.com/vssdkwcftools

IVsWCFReferenceManager referenceManager = refMgrFactory.GetReferenceManager(hierarchy);

 IVsWCFReferenceGroupCollection referenceGroups = referenceManager.GetReferenceGroupCollection();

The namespace I was after was Microsoft.VisualStudio.WCFReference.Interop in C:\Program Files (x86)\Microsoft Visual Studio 2010 Beta2 SDK\VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.WCFReference.Interop.dll

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜