December 24, 2020

dotnet-svcutil - Generate Proxy Code with namespace

dotnet-svcutil helps you generate WCF Client proxy code for target service, for example:

dotnet-svcutil https://localhost:8081/OrderManagement/OrderManagement.svc 
               -d "Connected Services/MyOrderManagementService"

In this command we have provided directory path where we want to generate the proxy code output. In this case we have the path Connected Services/MyOrderManagementService from current directory.

You may notice that in the output code, it will generate the namespace with similar name, i.e. namespace Connected_Services_MyOrderManagementService:

If you want to change the namespace, you can use n (namespace) parameter.

Using this command:

dotnet-svcutil https://localhost:8081/OrderManagement/OrderManagement.svc 
               -d "Connected Services/MyOrderManagementService"
               -n "*,MyNewNamespaceForOrderManagementService"

This time, the output code will contain the namespace MyNewNamespaceForOrderManagementService.

References:

Related Post(s):

No comments:

Post a Comment