VSTS build: Packages failed to restore - Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'

后端 未结 5 1355
盖世英雄少女心
盖世英雄少女心 2020-12-25 13:33

I\'m getting

Unable to resolve \'NETStandard.Library (>= 1.6.1)\' for \'.NETStandard,Version=v2.0\'.

in VSTS build using Hosted

相关标签:
5条回答
  • 2020-12-25 14:03

    What worked for me was installing .NET Core SDK 2.0 and making the following changes:

    in .csproj:

    change

    <TargetFramework>netcoreapp1.1.0</TargetFramework>
    

    to

    <TargetFramework>netcoreapp2.0</TargetFramework>
    

    and in global.json:

    "sdk": { "version": "1.1.0" }
    

    to

    "sdk": { "version": "2.0.0" }
    

    I didn't know how to use Chris Paton' solution

    0 讨论(0)
  • 2020-12-25 14:07

    I have received a similar error after generating a project using dotnet new angular which created a project relying on netcoreapp2.0. Inspection of project properties revealed that version 2.0 was not properly recognized (did not appear in the installed framework list).

    Solution was to update Visual Studio 2017, as the minimum version required to support netcoreapp2.0 projects seems to be 15.3.1.

    0 讨论(0)
  • 2020-12-25 14:17

    Update 18/09/2017

    Step 2 is no longer needed. I've left it in the solution though as it may still help some people. Thanks, @Liero for point this out.


    Original Answer

    I've just experienced this problem too and solved it by doing three things:

    1. Use the .NET Core SDK(! - not runtime!) version 2.0.0:

    2. Use the latest NuGet feed (4.3.0):

    3. Restore your packages:

    Update It's worth mentioning here that you should specify where you get your NuGet packages from. Most applications will probably just use the NuGet.org feed, as per the screenshot (see small checkbox), but you may have your custom feeds specified in a NuGet.config file. In that case, tick 'Feeds in my NuGet.config' and then specify the path to that file.

    To illustrate the order, this is my working queue:

    I hope this helps you and anyone else who has come up against this problem. If you have any questions, let me know. :)

    0 讨论(0)
  • 2020-12-25 14:23

    You should select Feed(s) I select here for Feeds to use option. If you leave Use packages from this VSTS/TFS feed empty, packages will be downloaded from https://dist.nuget.org/.

    Else, if you want to use Feeds in my NuGet.config as Feeds to use, you should specify the path for your NuGet.config file.

    0 讨论(0)
  • 2020-12-25 14:23

    Updating the Visual Studio 2017 to latest 15.4.1 version resolved the problem for me.

    0 讨论(0)
提交回复
热议问题