10
votes

I'm trying to build an app using .NET Core 2.0.0 Preview 1 on VSTS, but I'm getting this error while trying to restore the nuget packages:

Unable to resolve 'Microsoft.NETCore.App (>= 2.0.0)' for '.NETCoreApp,Version=v2.0'.

Any workaround for this?

2
please consider about accepting my answer as the correct one because it got more upvotes than the answer accepted.Rukshan Dangalla

2 Answers

6
votes

It seems you were use Hosted VS2017 agent to queue your build. While Hosted VS2017 agent only has .NET core 1.0.0 installed (you can find installed software here).

The work around to build apps using .NET core 2.0.0, you should use a private agent where the .NET core 2.0.0 and Visual Studio 2017 Preview 15.3 is installed.

8
votes

Here is how I solved the issue.

  1. Use .NET Core Tool Installer (Preview) as the immediate after get source step. enter image description here

  2. Use the Nugget feed as next step

enter image description here

  1. Change Restore step to use Feed(s) I select here.

enter image description here

Finally build steps looks like this.

enter image description here