问题描述
我有一个 .net core 2.0 控制台应用程序.我正在尝试使用以下命令从 TFS 读取文件:
<块引用>使用.NETFramework,Version=v4.6.1"而不是项目目标框架.NETCoreApp,Version=v2.0"恢复包Microsoft.AspNet.WebApi.Client 5.2.2".此软件包可能与您的项目不完全兼容.
即使在抑制警告之后,我仍然会收到错误并且无法引用库.我怎样才能得到这个参考解决?
很容易复制:
- 新的 .net core 2.0 控制台应用
- 复制上述问题中的方法
- 尝试安装nuget包
该包暂时不完全兼容dotnetcore 2.0.
例如,对于 'Microsoft.AspNet.WebApi.Client'
,它可能在版本 (5.2.4) 中得到支持.有关详细信息,请参阅使用新的 Microsoft.AspNet.WebApi.Client.5.2.4 包.
您可以尝试将 标准客户端 包作为费德里科提到了.
如果这仍然不起作用,那么作为一种解决方法,您只能创建 Console App (.Net Framework)
而不是 .net core 2.0 控制台应用程序.
参考这个线程:Microsoft.AspNet.WebApi.NET Core 是否支持.Client?
I have a .net core 2.0 console app. I'm trying to read files from TFS using the following:
How to get a file from TFS directly into memory (i.e., don't want to read from file system into memory)?
I head over to nuget and install Microsoft.TeamFoundationServer.ExtendedClient
and run into this:
Package 'Microsoft.AspNet.WebApi.Client 5.2.2' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project.
Even after suppressing the warning, I still get the error and can't reference the library. How can I get this reference resolving?
Very easy to repro:
- New .net core 2.0 console app
- Copy the method from the above question
- Try to install the nuget package
The package is not fully compatible with dotnetcore 2.0 for now.
eg, for 'Microsoft.AspNet.WebApi.Client'
it maybe supported in version (5.2.4).
See Consume new Microsoft.AspNet.WebApi.Client.5.2.4 package for details.
You could try the standard Client package as Federico mentioned.
If that still not work, then as a workaround you can only create a Console App (.Net Framework)
instead of the .net core 2.0 console app.
Reference this thread: Microsoft.AspNet.WebApi.Client supported in .NET Core or not?
这篇关于.net Core 2.0 - 使用 .NetFramework 4.6.1 而不是目标框架 .netCore 2.0 恢复了包.软件包可能不完全兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!