Olivier Charton
Olivier Charton

Reputation: 1

svcutil.exe update service reference

I am using a solution referencing several services. It's time consuming to update all services one by one and can lead to oversights. I am asked if I can find a way to automatically update all references through svcutil at build time.

What I got to work was to generate a class using the endpoint of the service but it does not update the reference in the project nor generate all other files like *.xsd

I tried several syntaxes, got it to work in the .csproj like this

<Target Name="AfterBuild"> 
    <Message Text="Updating Web Reference..."/> 
    <Exec Command="&quot;{pathToSvcutil}\svcutil.exe&quot; &quot;{urlToServiceEndpoint}&quot; /out:&quot;{SomeLocalPath}\Test.cs&quot; /n:&quot;*,{MyNamespace}&quot;"/> 
</Target>

I'm not really sure though if the /n is very useful in my case or if I need the /out parameter (used it because otherwise the build was successful but nothing seemed to change)

Bonus point : I was planning to use the command for every service I have to update, but is there any more elegant way ?

Thanks a lot

Edit : I don't know if I was accurate enough, so what I truly want is to have the exact same behavior as when I click on services references and press "Update"

Upvotes: 0

Views: 1005

Answers (0)

Related Questions