简体   繁体   中英

How to add a WCF service reference in a .NET Core 3.1 application?

I'm attempting to add a WCF service reference to a.Net Core 3.1 web API. I'm using Visual Studio 2019 in admin mode. I get the following error:

Importing web service metadata ...
Number of service endpoints found: 1
Scaffolding service reference code ...
Error:Unable to generate deps.json, it may have been already generated.  You can specify the "-d" option before the tool name for diagnostic output (for example, "dotnet -d <toolname>": C:\Program Files\dotnet\sdk\3.1.101\Sdks\Microsoft.NET.Sdk\targets\GenerateDeps\GenerateDeps.proj

Anyone have any ideas how to resolve this?

I've tried installing dotnet-svcutil but I get the following error:

Package dotnet-svcutil 2.0.1 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package dotnet-svcutil 2.0.1 supports: netcoreapp2.1 (.NETCoreApp,Version=v2.1) / any

Dotnet released preview of version 2.0.3. which work with dotnet Core 3.1. Install it trough package manager console and reopen project.

dotnet tool install --global dotnet-svcutil --version 2.0.3-preview1.20574.1

In solution explorer right click on project name -> Add -> Connected Service, should offer Microsoft WCF Web Service Reference Provider

I faced the same issue.

Open Visual Studio Developer Command prompt and use below command " svcutil *.wsdl " or " svcutil https://somestire.svc "

This will create Class file in that specific folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM