Can you access 'Service Reference' Programmatically?
-
22-09-2019 - |
Question
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));
}
MessageBox.Show(sb.ToString());
project does have the property:
project.WebReferencesFolder
but it is null (yes, I do have a service reference added, honest)
Solution
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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow