Search code examples
wcfvisual-studio-2010add-invsx

Is it possible to refresh WCF service reference from VS2010 addin?


I want to "simulate" the Right click/Update service reference command in a VS2010 addin. I have a reference to the containing (Silverlight...) project, I know the name of the service reference and the url of the service.
I've found this: http://dedjo.blogspot.com/2007/03/adding-web-references-to-your-vs.html , but it only works for asmx (it uses System.Web.Services instead of System.ServiceModel), not wcf. Is there any choice but call svcutil from code? if so, how? (do I use svcutil or slsvcutil? How do I call it from inside the addin?)
thanks


Solution

  • I believe the visual studio command for this is "Project.UpdateServiceReference". So I guess you can try to select the node you're interested in, and run this command, like this:

    envDTE.Windows.Item(vsWindowKindSolutionExplorer).Activate();
    envDTE.ActiveWindow.Object.GetItem(@"MyProject\Service References\Proxy").Select(vsUISelectionType.vsUISelectionTypeSelect);
    envDTE.ExecuteCommand("Project.UpdateServiceReference");