VSTS Build Error – Not compatible with netcoreapp2.0

I recently setup a new VSTS CI build for a .NET Core project which initially threw an error during the Nuget Restore step:

The nuget command failed with exit code(1) and error(Errors in C:\agent\_work\2\s\Acme.Function.App.Client\Acme.Function.App.Client.csproj
Project Acme.Function.Model is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Project Acme.Function.Model supports: netstandard2.0 (.NETStandard,Version=v2.0)
One or more projects are incompatible with .NETCoreApp,Version=v2.0.)

Packages failed to restore

I eventually found a couple blog posts which said I needed to use version 4.3 of Nuget.  Sure enough the logs indicated it was using version 4.1:

2018-06-10T18:47:36.3507543Z Found tool in cache: NuGet 4.1.0 x64
2018-06-10T18:47:36.3508209Z Found tool in cache: NuGet 4.1.0 x64
2018-06-10T18:47:36.3508638Z Resolved from tool cache: 4.1.0
2018-06-10T18:47:36.3508768Z Using version: 4.1.0

So first I looked at how to update Nuget on a server which didn’t really yield any good results.  And then I remembered I had a Nuget Installer task in my other pre-existing.

image

After adding the Nuget installer task my Nuget Restore finds the new version and works correctly:

2018-06-10T23:35:49.5684338Z ##[section]Starting: NuGetCommand
2018-06-10T23:35:49.5690020Z ==============================================================================
2018-06-10T23:35:49.5690171Z Task         : NuGet
2018-06-10T23:35:49.5690362Z Description  : Restore, pack, or push NuGet packages, or run a NuGet command. Supports NuGet.org and authenticated feeds like Package Management and MyGet. Uses NuGet.exe and works with .NET Framework apps. For .NET Core and .NET Standard apps, use the .NET Core task.
2018-06-10T23:35:49.5690554Z Version      : 2.0.27
2018-06-10T23:35:49.5690661Z Author       : Microsoft Corporation
2018-06-10T23:35:49.5691633Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613747)
2018-06-10T23:35:49.5691786Z ==============================================================================
2018-06-10T23:35:51.9450364Z [command]C:\Windows\system32\chcp.com 65001
2018-06-10T23:35:51.9453225Z Active code page: 65001
2018-06-10T23:35:52.7013055Z Detected NuGet version 4.3.0.4406 / 4.3.0

Hope this quick post was helpful.  If so or you have further questions please a comment below.

Happing Building!

3 thoughts on “VSTS Build Error – Not compatible with netcoreapp2.0”

  1. Thanks so much for this! It’s taken me 2 days and a lot of fiddling to try figure out what was going on here. FYI in my case the problem was with a Unit Test project pointing at an Azure function app. It’s finally running through now!

Leave a Reply