Pipeline Nuget restore failing on .Net Core 3.0 Pr

2020-02-11 03:27发布

I updated a project from netcoreapp2.2 to netcoreapp3.0 and use Preview8 SDK as well as Microsoft.EntityFrameworkCore.SqlServer, tools, and design.

I can build and run my projects locally just find (VS 2019). But when I try to deploy with Azure DevOps, the Nuget restore gives this error:

NU1202: Package Microsoft.EntityFrameworkCore.SqlServer 3.0.0-preview8.19405.11 is not compatible with netcoreapp3.0 (.NETCoreApp,Version=v3.0). Package Microsoft.EntityFrameworkCore.SqlServer 3.0.0-preview8.19405.11 supports: netstandard2.1 (.NETStandard,Version=v2.1)

Every reference to an EntityFrameworkCore package will result in that error.

I'm setting the .Net Core SDK in the pipeline to Preview8 via a global.json.

I have a NuGet tool installer task, bringing in the latest version, and a Nuget Restore task command running against my solution.

4条回答
别忘想泡老子
2楼-- · 2020-02-11 03:50

EDIT: Yay, I have enough rep to comment now.

It turns out the easier fix is to updatethe NuGet package version to the latest (5.3.0) in the "Use NuGet" task.


Not enough rep to comment on Fernando's response but it worked for me.

Edit the pipeline's Agent tasks:

  • add .NET Core, Display name: dotnet restore, Command: restore
  • set up other properties pretty much the same as the existing NuGet Restore
  • remove NuGet restore
查看更多
老娘就宠你
3楼-- · 2020-02-11 03:57

My problem was that I was using the Nuget Restore. Changing it to dotnet restore made the trick.

enter image description here

查看更多
Rolldiameter
4楼-- · 2020-02-11 04:00

This problem is caused by an obsolete version of NuGet agent.

Use NuGet Install Tool task (a.k.a. Use NuGet) and setup the agent to the v5.x.

Update of NuGet Build Agent.

This is a low profile solution.

查看更多
祖国的老花朵
5楼-- · 2020-02-11 04:02

Pipeline Nuget restore failing on .Net Core 3.0 Preview 8 project (NU1202)

If you are using the host agent, you should make sure you have install the netcoreapp3.0 on the agent. You could use the task Use .NET Core to install it:

enter image description here

Note check the option Include Preview Versions.

Note: Since netcoreapp3.0 supported by Visual Studio 2019, so, you need to make sure your agent is Hosted Windows 2019 with VS2019.

Hope this helps.

查看更多
登录 后发表回答