问题描述
我遵循了很多方法,这里主要有两种:
通过 Nuget 安装: 我创建了一个专用的 .Net Core 2.1 控制台应用程序。 通过 nuget ui 添加 svutil 2.0.2 我得到:
Package 'dotnet-svcutil 2.0.2' has a package type 'DotnetTool' that is not supported by project 'TestWS'.
Invalid project-package combination for dotnet-svcutil 2.0.2. DotnetToolReference project style can only contain references of the DotnetTool type
Package dotnet-svcutil 2.0.2 is not compatible with netcoreapp2.1 (.NETCoreApp,Version=v2.1). Package dotnet-svcutil 2.0.2 supports: netcoreapp2.1 (.NETCoreApp,Version=v2.1) / any
安装为全局工具 我跑
dotnet tool install --global dotnet-svcutil --version 2.0.2
或
dotnet tool install --global dotnet-svcutil
但出现错误,可能的原因是公司代理身份验证,我无法设置代理 url
最终目标是注册一个 wdsl 文件。我得到了它并手动创建了一个 .cs 类来实现它,但是如果没有注册连接的服务,我就无法为不同的环境设置 url anche 更改它
解决方法
这个包是用于 dotnet cli 的工具,而不是用于项目的工具。您应该将其安装到 dotnet cli 中。
检查您的环境,您有足够的权利控制 PC。
以管理员身份运行cmd,然后输入:
dotnet tool install --global dotnet-svcutil --version 2.0.2
或者您应该按照 this guidance 将您的公司代理添加到全局 nuget.config
文件中。