svcutil.exe

Svcutil --update error output not making sense


I am trying to update a soap service reference using svcutil.

I have tried:

 dotnet svcutil -u --projectFile "C:\projects\MySolution\MyProject\MyProject.csproj"

Which gives the nonsensical error:

Warning: The specified --projectFile option is not expected in the current operational context of the tool!
Error: The --update option requires a project to be specified, please use the --projectFile option to specify the project to use.

And:

dotnet svcutil -u --projectFile "C:\projects\MySolution\MyProject\MyServiceFolder"

Same Error

And I have tried:

dotnet svcutil -u --projectFile "C:\projects\MySolution\MyProject\MyServiceFolder\dotnet-svcutil.params.json"

Same error.

I have even tried:

dotnet svcutil -u "C:\projects\MySolution\MyProject\Nexus.Services.csproj"

and

dotnet svcutil -u "C:\projects\MySolution\MyProject\MyServiceFolder"

But that gives the error:

Error: The --update option requires a project to be specified, please use the --projectFile option to specify the project to use.

I cannot find a single example anywhere of how this command should be run.

Has anyone gotten this to work?


Solution

  • To update a service reference using dotnet svcutil --update ..., it needs to find both the project file and the service reference configuration.

    From the help dotnet-svcutil --help:

    --projectFile <project file> The project file to add the client to (if any). (Short Form: -pf).
    --update <web service reference> Updates an existing web service reference. If the project contains more than one web service reference, the name of the web service reference to be updated is required. (Short Form: -u).

    When you run the svcutil in a different directory than the one containing your project file, you will need to tell it explicitly where your project is using --projectFile.

    So, the easiest solution is to run the update command from the directory containing your project and specify where the service reference is:

    dotnet svcutil -u .\path\to\ServiceReference
    

    You can specify the path of the directory containig the dotnet-svcutil.params.json file, or an explicit path to a config file.

    From the examples printed when running dotnet svcutil -h:

    dotnet-svcutil -u ServiceReference

    • Update existing web service reference named ServiceReference. The command need to be executed under directory which contains the project file.