我正在macOS上运行,并且我正在从事的项目刚刚从.NET Core 2升级到.NET Core3。问题是我无法再在Rider中构建项目。如果尝试使用dotnet build在终端中构建它,则构建成功。在我的项目中,有一些子项目使用netstandard2,但这应该不是问题(因为它在终端中工作)。我收到以下错误消息:
Project1 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Project2 supports: netstandard2.1 (.NETStandard,Version=v2.1)
我尝试添加一个global.json文件,该文件指定我使用的是.NET Core版本3,但没有帮助。
如果我在终端中运行一次dotnet构建,那么Rider的新构建将成功。因此一切正常,但是总是总是首先在终端中构建是很烦人的。
dotnet --info的输出: dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.14
OS Platform: Darwin
RID: osx.10.14-x64
Base Path: /usr/local/share/dotnet/sdk/3.0.100/
Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33
.NET Core SDKs installed:
2.2.300 [/usr/local/share/dotnet/sdk]
2.2.401 [/usr/local/share/dotnet/sdk]
2.2.402 [/usr/local/share/dotnet/sdk]
3.0.100 [/usr/local/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
答案 0 :(得分:2)
我发现问题出在骑士身上。解决方法是将 PackageReference Restore Engine (在 File> Settings> Build,Execution,Deployment> NuGet 中)更改为 MSBuild 。
该问题将在Rider的更高版本中得到修复,因此建议在发布该版本后切换回 Embedded 。 MSBuild 和嵌入式之间的区别:
MSBuild只是调用外部MSBuild任务。嵌入式直接通话 Rider进程内的NuGet API。嵌入式应该工作更快,并且 它提供了其他日志,这些日志在还原失败时很有用
问题的原因:
[...]因为Rider 2019.2 EAP2仍在内部使用NuGet 4.9;这个 版本没有适当的.NET Core 3.0 / .NET Standard支持 2.1。在Rider 2019.2 RTM中,我们将把NuGet的内部版本升级到5.1。
报价和屏幕截图的来源: https://youtrack.jetbrains.com/issue/RIDER-29888