Azure-pipelines-tasks: NuGet targets, unable to resolve Microsoft.NETCore.App

Created on 13 Jun 2017  路  27Comments  路  Source: microsoft/azure-pipelines-tasks

Hi,

I followed closely the thread here: https://github.com/Microsoft/vsts-tasks/issues/3311
and it was said that improvement would be made so you could update more quickly the images on the agents, namely VS 2017.

I still cannot use .net core 2.0 in the Hosted VS 2017 as of today although .net core 2.0 preview 1 was released several weeks ago.
I cannot even use the Hosted linux and the official docker image as the Hosted linux agents are not available in my hosted agent pool in my team project (not released yet...).

Could you please clarify the plans?

C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Unable to resolve 'Microsoft.NETCore.App (>= 2.0.0)' for '.NETCoreApp,Version=v2.0'.

Detected package downgrade: NETStandard.Library from 2.0.0-preview1-25301-01 to 1.6.1 

Most helpful comment

Actually, three steps vere required to make it work: https://stackoverflow.com/a/45739237/475727

I believe it could work by default without the three steps...

All 27 comments

The VS2017 hosted pool has VS 2017 with all features installed on it. The issues from #3311 (latency while in preview going to release) are not relevant since the image now has the full release VS 2017.

I'm adding the packaging team for your nuget issue.

@alexmullans

Thanks @bryanmacfarlane

Some additional information.

I have two csproj, one targeting netstandard2.0 (projA) with the following package references:

<ItemGroup>
    <PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
    <PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
    <PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
    <PackageReference Include="System.Xml.XPath" Version="4.3.0" />
    <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.0.0-preview1-final"/>
    <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.0.0-preview1-final"/>
    <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.0.0-preview1-final"/>
    <PackageReference Include="System.ComponentModel" Version="4.3.0" />
    <PackageReference Include="System.Linq" Version="4.3.0" />
  </ItemGroup>

and the other one (unit test) targeting .netcoreapp2.0 with the following references:

 <ItemGroup>
    <PackageReference Include="xunit" Version="2.3.0-beta*" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-beta*" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-*" />
    <PackageReference Include="System.Reflection.TypeExtensions" Version="4.3.0" />
    <PackageReference Include="System.Runtime.Serialization.Formatters" Version="4.3.0" />
    <PackageReference Include="System.Xml.XmlDocument" Version="4.3.0" />
    <PackageReference Include="System.Xml.XmlSerializer" Version="4.3.0" />
    <PackageReference Include="System.Xml.XPath" Version="4.3.0" />
    <PackageReference Include="System.Xml.ReaderWriter" Version="4.3.0" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.0.0-preview1-final" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\projA.csproj" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0-preview1-final" />
  </ItemGroup>

I put a global.json as follow (this is the official sdk for preview 1 release):

{
    "sdk": {
        "version": "2.0.0-preview1-005957"
    }
}

but the VS 2017 agent still use the 1.0.4 sdk that does not support 2.0 packages.

C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning : Detected package downgrade: NETStandard.Library from 2.0.0-preview1-25301-01 to 1.6.1  [d:\a\1\s\Main\Source\Project\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> Microsoft.Extensions.Configuration.Json (>= 2.0.0-preview1-final) -> NETStandard.Library (>= 2.0.0-preview1-25301-01)  [d:\a\1\s\Main\Source\Project\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> NETStandard.Library (>= 1.6.1) [d:\a\1\s\Main\Source\Project\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning : Detected package downgrade: NETStandard.Library from 2.0.0-preview1-25301-01 to 1.6.1  [d:\a\1\s\Main\Source\Project\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> Microsoft.Extensions.Configuration.Binder (>= 2.0.0-preview1-final) -> NETStandard.Library (>= 2.0.0-preview1-25301-01)  [d:\a\1\s\Main\Source\Project\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> NETStandard.Library (>= 1.6.1) [d:\a\1\s\Main\Source\Project\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning : Detected package downgrade: NETStandard.Library from 2.0.0-preview1-25301-01 to 1.6.1  [d:\a\1\s\Main\Source\Project\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> Microsoft.Extensions.Configuration.Abstractions (>= 2.0.0-preview1-final) -> NETStandard.Library (>= 2.0.0-preview1-25301-01)  [d:\a\1\s\Main\Source\Project\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> NETStandard.Library (>= 1.6.1) [d:\a\1\s\Main\Source\Project\projA\projA.csproj]

So I think VS 2017 image does not natively provide the 2.0 preview 1 sdk.

@Jonathan34 can you try adding a NuGet Tool Installer task at the beginning of your build that specifies version 4.1.0? I'm wondering if this is a NuGet 4.0 issue.

Starting: Use NuGet 4.10
******************************************************************************
Downloading: https://dist.nuget.org/win-x86-commandline/v4.1.0/nuget.exe
Caching tool: NuGet 4.1.0 x64
Using version: 4.1.0
Found tool in cache: NuGet 4.1.0 x64
Using tool path: d:\a\_tool\NuGet\4.1.0\x64
Prepending PATH environment variable with directory: d:\a\_tool\NuGet\4.1.0\x64
******************************************************************************
Finishing: Use NuGet 4.10
******************************************************************************
******************************************************************************
Starting: Restore
******************************************************************************
==============================================================================
Task         : .NET Core
Description  : Build, test and publish using dotnet core command-line.
**Version      : 1.0.2**
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
==============================================================================
"C:\Program Files\dotnet\dotnet.exe" restore "d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj"
  Restoring packages for d:\a\1\s\Main\Source\proj\projA\projA.csproj...
  Restoring packages for d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj...
  Installing runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple 4.3.0.
  Installing runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
  Installing runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
  Installing runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
  Installing runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
  Installing System.Reflection.TypeExtensions 4.3.0.
  Installing runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
  Installing runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
  Installing runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
  Installing runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
  Installing System.Xml.XmlDocument 4.3.0.
  Installing System.Xml.XmlSerializer 4.3.0.
  Installing runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
  Installing System.Xml.ReaderWriter 4.3.0.
  Installing runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
  Installing System.Runtime.Serialization.Formatters 4.3.0.
  Installing System.Xml.XPath 4.3.0.
  Installing System.Security.Cryptography.Csp 4.3.0.
  Installing System.Security.Cryptography.Cng 4.3.0.
  Installing runtime.native.System.Security.Cryptography.Apple 4.3.0.
  Installing System.Security.Cryptography.OpenSsl 4.3.0.
  Installing System.Globalization.Extensions 4.3.0.
  Installing xunit.runner.visualstudio 2.3.0-beta3-build3705.
  Installing xunit 2.3.0-beta3-build3705.
  Installing Microsoft.Extensions.Configuration.Abstractions 2.0.0-preview1-final.
  Installing Microsoft.NET.Test.Sdk 15.3.0-preview-20170601-03.
  Installing System.Reflection 4.3.0.
  Installing System.Runtime 4.3.0.
  Installing System.Diagnostics.DiagnosticSource 4.3.0.
  Installing System.Collections 4.3.0.
  Installing System.Diagnostics.Debug 4.3.0.
  Installing System.Globalization 4.3.0.
  Installing System.IO 4.3.0.
  Installing System.Resources.ResourceManager 4.3.0.
  Installing System.Runtime.Extensions 4.3.0.
  Installing System.Text.Encoding 4.3.0.
  Installing System.Threading 4.3.0.
  Installing System.Threading.Overlapped 4.3.0.
  Installing Microsoft.Extensions.FileSystemGlobbing 2.0.0-preview1-final.
  Installing Microsoft.Extensions.FileProviders.Abstractions 2.0.0-preview1-final.
  Installing System.IO.FileSystem.Watcher 4.3.0.
  Installing Microsoft.Extensions.FileProviders.Physical 2.0.0-preview1-final.
  Installing System.Threading.Thread 4.3.0.
  Installing Microsoft.CSharp 4.3.0.
  Installing System.Linq 4.3.0.
  Installing System.Runtime.CompilerServices.Unsafe 4.4.0-preview1-25305-02.
  Installing System.ComponentModel.Primitives 4.3.0.
  Installing System.Collections.Specialized 4.3.0.
  Installing System.Collections.NonGeneric 4.3.0.
  Installing System.Reflection.Emit 4.3.0.
  Installing runtime.native.System.Security.Cryptography.OpenSsl 4.3.0.
  Installing System.Reflection.Emit.ILGeneration 4.3.0.
  Installing NETStandard.Library 1.6.1.
  Installing runtime.native.System.Net.Http 4.3.0.
  Installing System.Reflection.Emit.Lightweight 4.3.0.
  Installing System.Buffers 4.3.0.
  Installing runtime.native.System.IO.Compression 4.3.0.
  Installing System.ComponentModel 4.3.0.
  Installing System.Reflection.Extensions 4.3.0.
  Installing System.Reflection.Primitives 4.3.0.
  Installing Microsoft.Extensions.Configuration.Binder 2.0.0-preview1-final.
  Installing Microsoft.Extensions.Configuration.Json 2.0.0-preview1-final.
  Installing Microsoft.NETCore.Platforms 1.1.0.
  Installing Microsoft.Win32.Primitives 4.3.0.
  Installing System.AppContext 4.3.0.
  Installing System.Collections.Concurrent 4.3.0.
  Installing System.Console 4.3.0.
  Installing System.Diagnostics.Tools 4.3.0.
  Installing System.Diagnostics.Tracing 4.3.0.
  Installing System.Text.RegularExpressions 4.3.0.
  Installing System.Globalization.Calendars 4.3.0.
  Installing System.IO.FileSystem 4.3.0.
  Installing System.IO.FileSystem.Primitives 4.3.0.
  Installing System.Runtime.InteropServices 4.3.0.
  Installing System.IO.Compression 4.3.0.
  Installing System.IO.Compression.ZipFile 4.3.0.
  Installing System.Text.Encoding.Extensions 4.3.0.
  Installing System.Threading.Tasks 4.3.0.
  Installing System.Threading.Tasks.Extensions 4.3.0.
  Installing System.Runtime.Serialization.Primitives 4.3.0.
  Installing System.Linq.Expressions 4.3.0.
  Installing Microsoft.DotNet.PlatformAbstractions 1.1.0.
  Installing Microsoft.Extensions.DependencyModel 1.1.0.
  Installing System.Net.Http 4.3.0.
  Installing System.Net.Primitives 4.3.0.
  Installing Microsoft.TestPlatform.ObjectModel 15.0.0.
  Installing System.Net.Sockets 4.3.0.
  Installing xunit.analyzers 0.3.0.
  Installing xunit.assert 2.3.0-beta3-build3705.
  Installing System.ObjectModel 4.3.0.
  Installing xunit.core 2.3.0-beta3-build3705.
  Installing Microsoft.Extensions.Primitives 2.0.0-preview1-final.
  Installing NETStandard.Library 2.0.0-preview1-25301-01.
  Installing Microsoft.TestPlatform.TestHost 15.3.0-preview-20170601-03.
  Installing Microsoft.NETCore.Targets 1.1.0.
  Installing System.Runtime.Handles 4.3.0.
  Installing System.AppContext 4.1.0.
  Installing System.Collections 4.0.11.
  Installing System.IO 4.1.0.
  Installing System.Runtime.InteropServices.RuntimeInformation 4.3.0.
  Installing System.IO.FileSystem 4.0.1.
  Installing System.Runtime.Numerics 4.3.0.
  Installing System.Runtime.Extensions 4.1.0.
  Installing System.Security.Cryptography.Algorithms 4.3.0.
  Installing System.Security.Cryptography.Encoding 4.3.0.
  Installing System.Runtime.InteropServices 4.1.0.
  Installing System.Security.Cryptography.Primitives 4.3.0.
  Installing System.Security.Cryptography.X509Certificates 4.3.0.
  Installing System.Runtime.InteropServices.RuntimeInformation 4.0.0.
  Installing System.Diagnostics.Debug 4.0.11.
  Installing runtime.native.System 4.3.0.
  Installing System.Dynamic.Runtime 4.0.11.
  Installing System.Linq 4.1.0.
  Installing System.Threading.Timer 4.3.0.
  Installing Newtonsoft.Json 9.0.1.
  Installing NETStandard.Library 1.6.0.
  Installing System.Runtime.Serialization.Primitives 4.1.1.
  Installing System.Xml.XDocument 4.3.0.
  Installing System.ComponentModel.TypeConverter 4.3.0.
  Installing Microsoft.Extensions.Configuration 2.0.0-preview1-final.
  Installing System.Dynamic.Runtime 4.3.0.
  Installing Newtonsoft.Json 10.0.1.
  Installing System.Xml.XPath.XmlDocument 4.0.1.
  Installing System.ComponentModel.EventBasedAsync 4.0.11.
  Installing Microsoft.Extensions.Configuration.FileExtensions 2.0.0-preview1-final.
  Installing System.ComponentModel.TypeConverter 4.1.0.
  Installing System.Security.Cryptography.Algorithms 4.2.0.
  Installing System.Runtime.Serialization.Json 4.0.2.
  Installing System.Runtime.Loader 4.0.0.
  Installing System.Reflection.Metadata 1.3.0.
  Installing System.Diagnostics.Tracing 4.1.0.
  Installing System.Diagnostics.Process 4.1.0.
  Installing System.Diagnostics.TraceSource 4.0.0.
  Installing System.Threading.Thread 4.0.0.
  Installing System.Diagnostics.TextWriterTraceListener 4.0.0.
  Installing xunit.extensibility.execution 2.3.0-beta3-build3705.
  Installing xunit.extensibility.core 2.3.0-beta3-build3705.
  Installing Microsoft.Packaging.Tools 1.0.0-preview1-25301-01.
  Installing Microsoft.Extensions.DependencyModel 1.0.3.
  Installing Microsoft.TestPlatform.ObjectModel 15.3.0-preview-20170601-03.
  Installing System.Runtime 4.1.0.
  Installing Microsoft.NETCore.Platforms 1.0.1.
  Installing Microsoft.NETCore.Targets 1.0.1.
  Installing System.Text.Encoding 4.0.11.
  Installing System.Threading.Tasks 4.0.11.
  Installing System.IO.FileSystem.Primitives 4.0.1.
  Installing System.Runtime.Handles 4.0.1.
  Installing System.Reflection 4.1.0.
  Installing System.Reflection.Primitives 4.0.1.
  Installing runtime.native.System 4.0.0.
  Installing System.Resources.ResourceManager 4.0.1.
  Installing System.Threading 4.0.11.
  Installing System.Globalization 4.0.11.
  Installing System.Linq.Expressions 4.1.0.
  Installing System.ObjectModel 4.0.12.
  Installing System.Reflection.Emit 4.0.1.
  Installing System.Reflection.Emit.ILGeneration 4.0.1.
  Installing Microsoft.CSharp 4.0.1.
  Installing System.Reflection.Extensions 4.0.1.
  Installing System.Text.Encoding.Extensions 4.0.11.
  Installing System.Text.RegularExpressions 4.1.0.
  Installing System.Xml.XDocument 4.0.11.
  Installing Microsoft.Win32.Primitives 4.0.1.
  Installing System.Collections.Concurrent 4.0.12.
  Installing System.Console 4.0.0.
  Installing System.Diagnostics.Tools 4.0.1.
  Installing System.Globalization.Calendars 4.0.1.
  Installing System.IO.Compression 4.1.0.
  Installing System.IO.Compression.ZipFile 4.0.1.
  Installing System.Net.Http 4.1.0.
  Installing System.Net.Primitives 4.0.11.
  Installing System.Net.Sockets 4.1.0.
  Installing System.Runtime.Numerics 4.0.1.
  Installing System.Security.Cryptography.Encoding 4.0.0.
  Installing System.Security.Cryptography.Primitives 4.0.0.
**C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning : Detected package downgrade: NETStandard.Library from 2.0.0-preview1-25301-01 to 1.6.1  [d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> Microsoft.Extensions.Configuration.Binder (>= 2.0.0-preview1-final) -> NETStandard.Library (>= 2.0.0-preview1-25301-01)  [d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> NETStandard.Library (>= 1.6.1) [d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning : Detected package downgrade: NETStandard.Library from 2.0.0-preview1-25301-01 to 1.6.1  [d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> Microsoft.Extensions.Configuration.Abstractions (>= 2.0.0-preview1-final) -> NETStandard.Library (>= 2.0.0-preview1-25301-01)  [d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> NETStandard.Library (>= 1.6.1) [d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning : Detected package downgrade: NETStandard.Library from 2.0.0-preview1-25301-01 to 1.6.1  [d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> Microsoft.Extensions.Configuration.Json (>= 2.0.0-preview1-final) -> NETStandard.Library (>= 2.0.0-preview1-25301-01)  [d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> NETStandard.Library (>= 1.6.1) [d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj]**
  Generating MSBuild file d:\a\1\s\Main\Source\proj\projA\obj\projA.csproj.nuget.g.props.
  Generating MSBuild file d:\a\1\s\Main\Source\proj\projA\obj\projA.csproj.nuget.g.targets.
  Writing lock file to disk. Path: d:\a\1\s\Main\Source\proj\projA\obj\project.assets.json
  Restore completed in 39.79 sec for d:\a\1\s\Main\Source\proj\projA\projA.csproj.
  Restoring packages for d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj...
  Installing System.Security.Cryptography.X509Certificates 4.1.0.
  Installing System.Threading.Timer 4.0.1.
  Installing System.Collections.NonGeneric 4.0.1.
  Installing System.Collections.Specialized 4.0.1.
  Installing System.ComponentModel 4.0.1.
  Installing System.ComponentModel.Primitives 4.1.0.
  Installing runtime.native.System.Security.Cryptography 4.0.0.
  Installing System.Private.DataContractSerialization 4.1.1.
  Installing System.Collections.Immutable 1.2.0.
  Installing Microsoft.Win32.Registry 4.0.0.
  Installing System.Collections.Immutable 1.3.1.
  Installing System.Threading.ThreadPool 4.0.10.
  Installing xunit.abstractions 2.0.1.
  Installing Microsoft.DotNet.PlatformAbstractions 1.0.3.
  Installing Microsoft.VisualStudio.Web.CodeGeneration.Tools 2.0.0-preview1-final.
  Installing System.Runtime.Loader 4.3.0.
  Installing System.Diagnostics.Process 4.3.0.
  Installing System.Diagnostics.TraceSource 4.3.0.
  Installing System.ComponentModel.EventBasedAsync 4.3.0.
  Installing System.Diagnostics.TextWriterTraceListener 4.3.0.
  Installing System.Runtime.Serialization.Json 4.3.0.
  Installing System.Reflection.Metadata 1.4.2.
  Installing System.Reflection.Emit.Lightweight 4.0.1.
  Installing runtime.native.System.IO.Compression 4.1.0.
  Installing System.Buffers 4.0.0.
  Restore completed in 6.14 sec for d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj.
  Installing runtime.native.System.Net.Http 4.0.1.
  Installing System.Diagnostics.DiagnosticSource 4.0.0.
  Installing System.Globalization.Extensions 4.0.1.
  Installing System.Security.Cryptography.OpenSsl 4.0.0.
  Installing System.Security.Cryptography.Cng 4.2.0.
  Installing System.Security.Cryptography.Csp 4.0.0.
  Installing Microsoft.Win32.Registry 4.3.0.
  Installing System.Threading.ThreadPool 4.3.0.
  Installing System.Private.DataContractSerialization 4.3.0.
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Unable to resolve 'Microsoft.NETCore.App (>= 2.0.0)' for '.NETCoreApp,Version=v2.0'. [d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj]
  Generating MSBuild file d:\a\1\s\Main\Source\proj\projA.UnitTests\obj\projA.UnitTests.csproj.nuget.g.props.
  Generating MSBuild file d:\a\1\s\Main\Source\proj\projA.UnitTests\obj\projA.UnitTests.csproj.nuget.g.targets.
  Writing lock file to disk. Path: d:\a\1\s\Main\Source\proj\projA.UnitTests\obj\project.assets.json
  Restore failed in 49.38 sec for d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj.

  Errors in d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj
      Unable to resolve 'Microsoft.NETCore.App (>= 2.0.0)' for '.NETCoreApp,Version=v2.0'.

  NuGet Config files used:
      C:\Users\buildguest\AppData\Roaming\NuGet\NuGet.Config
      C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config

  Feeds used:
      https://api.nuget.org/v3/index.json
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

  Installed:
      99 package(s) to d:\a\1\s\Main\Source\proj\projA\projA.csproj
      197 package(s) to d:\a\1\s\Main\Source\proj\projA.UnitTests\projA.UnitTests.csproj
**Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
"C:\Program Files\dotnet\dotnet.exe" restore "d:\a\1\s\Main\Source\proj\projA\projA.csproj"
  Restoring packages for d:\a\1\s\Main\Source\proj\projA\projA.csproj...
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning : Detected package downgrade: NETStandard.Library from 2.0.0-preview1-25301-01 to 1.6.1  [d:\a\1\s\Main\Source\proj\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> Microsoft.Extensions.Configuration.Json (>= 2.0.0-preview1-final) -> NETStandard.Library (>= 2.0.0-preview1-25301-01)  [d:\a\1\s\Main\Source\proj\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> NETStandard.Library (>= 1.6.1) [d:\a\1\s\Main\Source\proj\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning : Detected package downgrade: NETStandard.Library from 2.0.0-preview1-25301-01 to 1.6.1  [d:\a\1\s\Main\Source\proj\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> Microsoft.Extensions.Configuration.Binder (>= 2.0.0-preview1-final) -> NETStandard.Library (>= 2.0.0-preview1-25301-01)  [d:\a\1\s\Main\Source\proj\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> NETStandard.Library (>= 1.6.1) [d:\a\1\s\Main\Source\proj\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning : Detected package downgrade: NETStandard.Library from 2.0.0-preview1-25301-01 to 1.6.1  [d:\a\1\s\Main\Source\proj\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> Microsoft.Extensions.Configuration.Abstractions (>= 2.0.0-preview1-final) -> NETStandard.Library (>= 2.0.0-preview1-25301-01)  [d:\a\1\s\Main\Source\proj\projA\projA.csproj]
C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): warning :  projA (>= 13.0.200) -> NETStandard.Library (>= 1.6.1) [d:\a\1\s\Main\Source\proj\projA\projA.csproj]**
  Lock file has not changed. Skipping lock file write. Path: d:\a\1\s\Main\Source\proj\projA\obj\project.assets.json
  Restore completed in 542.52 ms for d:\a\1\s\Main\Source\proj\projA\projA.csproj.

Still fails :(
Sorry i put the whole log so you can see dependencies and everything in case something is wrong.
I noticed it tries to install Installing NETStandard.Library 1.6.1..
PS: this works fine on my mac locally, dotnet restore, and dotnet build.

I am having the same issue, please count me in.

This issues seems to appears on visual studio 2017 actually, not sure it is related to the VSTS tasks anymore. I do not have a windows machine on hand but will try to check on a colleague's machine.
the dotnet cli seems to work on windows. if someone can verify that on a windows environment :)

This is likely a consequence of the hosted agents not including preview versions of .net core.

probably it is one issue but even on a windows pc with .net core 2 preview 1 installed, the same issue appears when building with vs 2017. but not with the cli (on the same machine).

In my case it builds fine on my computer. It is just the VSTS task failing, probably because of the reason @jmyersmsft mentioned above.

@jmyersmsft This issue with hosted VSTS agents not having the latest bits of other things started to become a serious obstacle for me. I don't know if it is just me but I, as a developer, like to enjoy preview builds so that I can be ready for the future releases and also do my best to provide early feedback. As you might imagine, it is hard to give up on a build mechanism just because I prefer working on pre-release software. I am wondering if these pre-release software can be deployed to the hosted build agents (being VS 2017 agents in this case) once a major version is achieved? I don't mean to ask for every single beta release but at least for some releases like preview1, preview2, etc. This can be an automated task. May I ask for your opinion on that if you are the right person to ask? Thanks in advance!

@CoskunSunali that feedback will need to go back to @bryanmacfarlane. I'm from the package management service.

@CoskunSunali - customers rely on those images for production builds. For tools that are globally installed, need to wait until released (and even then they can destabilize someone).

We maintain pools for each era of VS and when VS2018 previews come out then we will have a preview of that one.

The problem is customer one wants everything else stable but preview of tool y installed and customer 2 wants everything else stable but preview of tool x installed.

There's two solutions to it:

  • Create your own private agent on an azure VM. You control your tool sets. You get incremental source, packages, etc...
  • Pull the tools JIT. .net core tools can be downloaded JIT at the front of the build. We recently create tool installers for this very reason. We will add a net core tools one for convenience (so you don't have to write a script). See here: https://youtu.be/Ie8EuvqJ0Hg

Also keep in mind that the reasons the builds start relative quickly is large elastic pools of machines from homogenous images in data centers. There are machines waiting around with the one VS2017 image that you use and the customer relying on that image for production builds. We will have a VS2015 pool and a VS2018 preview one when it comes out.

Or use the hosted linux agent and docker to build your app.
Or add a step similar to nuget installer that we put at the beginning that allows to pull any version.

If this is not resolved in the vs 2017 agent image, then i'll probably use docker.

@bryanmacfarlane I cannot disagree with anything you say. May I ask, what is your opinion on an agent that is specific for developers? I mean, having another one just like "VS 2017" but something like "VS 2017 Dev". Production customers would not be affected in that case.

By the way, I was able to use some PowerShell scripts to download the dotnet runtime as the first step of the build definition (as you mentioned). I also figured out how to use the dotnet.exe that shipped with that download and execute further commands like dotnet restore, etc. Please see https://stackoverflow.com/a/41741641

My current problem is somehow not being able to find the MSBuild version 15 (or 15.1?). The documentation states "15" but the build agent VS 2017 is unable to find it. The same goes for "15.1".

I tried pulling NuGet 4.1.0 using the NuGet Installer Tool to see if that would help but there is no documentation for how to refer to that downloaded custom version later on within the NuGet Packager and NuGet Publisher tasks. Your assistance would be highly appreciated on this matter.

Please see my comment at https://github.com/NuGet/Home/issues/5170#issuecomment-309064229

Yes, we have discussed multiple per era images ( and one could be dev ). I like your idea of vs2017-dev because we would only do that for the latest vs ( we could also call it just vs dev ). That mitigates the explosion of images and reduction of elasticity.

There's a couple other efforts that are just now taking shape

Tool installers - see video link above. We need a net core template that allows and encourages JIT pulling net core tools be version decouple from image

Docker - we're working on ability to select the image to run your build in. Works great for semi smaller images like net core. Not as viable for full VS but something we're aware of. Also related to yaml also in the works where you'll be able to declare image or images to run build and tests in. This really is the ideal solution for all of us - your defined env really is the same between dev, CI, prod

We just recently added the ability to have multiple hosted pools. We are also investing in the image generation process to turn around images faster. That will be critical for a dev

Sounds great. Thanks for the details!

These tool installers, once they are well documented and expanded to a range of other useful tools (including .NET Core) will be useful and will solve the problems of many, I believe.

Regarding the video, I just watched it but did not really get the idea of how to really use the NuGet Tools Installer. It is also unknown to me if using NuGet 4.1.0 would really fix the MSBuild 15/15.1 issue. I would be grateful if you had a link to a blog post, document or something like that. I spent two days trying to figure out how to customize the NuGet Packager and NuGet Publishers to use the custom version of NuGet that is JIT pulled using NuGet Tools Installer and also fail finding the appropriate MSBuild version - even though it is the "VS 2017" agent and is supposed to have MSBuild 15/15.1 - I feel there is lack of documentation on it.

Thanks for your time! 馃憤

@bryanmacfarlane A few updates from my end.

I wrote a PS script that downloads NuGet 4.1.0 and saves into a folder. Then the rest of my build uses that one and the issue with MSBuild 15 seems to be resolved. It may be a bug with NuGet 4.0.

And I also realized that I don't have to use the NuGet Packager and NuGet Publisher tasks at all. It seems that dotnet pack and dotnet nuget push are what I was supposed to use for convenience.

Thanks for your time replying!

NuGet 4.1 does indeed fix some issues. As of tomorrow, you should be able to replace your PowerShell script with the new NuGet Tool Installer task, specify 4.1.0 as the version to install, then use the new NuGet task to restore packages as expected.

We're also working on updates to properly support dotnet pack and dotnet nuget push in the dotnet task, but they're a sprint or two away.

A workaround I used to build .net core 2.0 preview projects on VSTS:

  1. Get dotnet-install.ps1 from https://github.com/dotnet/cli/tree/release/2.0.0-preview2/scripts/obtain. Make sure it is from the correct branch that your code needs.
  2. Configure a PowerShell Script task to run this script. By default, this script will install the .net core sdk in $(LOCALAPPDATA)\Microsoft\dotnet.
  3. Configure several Command Line tasks to run restore, build, test, and publish with dotnet cli. Instead of using dotnet directly, the full path of the installed sdk should be used, which is $(LocalAppData)\Microsoft\dotnet\dotnet.exe.

With the above steps, I can build the .net core 2.0 preview projects successfully with VSTS.

.net core 2.0 is final and still not solved.

I've added NuGet Tool Installer task that installs v4.3.0 as well as.NET Core Tool Installer and still getting:

C:\Program Files\dotnet\sdk1.0.4\NuGet.targets(97,5): error : Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'.

2017-08-16T15:44:41.1987575Z ##[section]Starting: Use NuGet 4.x
2017-08-16T15:44:41.2157578Z ==============================================================================
2017-08-16T15:44:41.2157578Z Task         : NuGet Tool Installer
2017-08-16T15:44:41.2157578Z Description  : Acquires a specific version of NuGet from the internet or the tools cache and adds it to the PATH. Use this step to change the version of NuGet used in the NuGet Restore and NuGet Command steps.
2017-08-16T15:44:41.2157578Z Version      : 0.1.1
2017-08-16T15:44:41.2157578Z Author       : Microsoft Corporation
2017-08-16T15:44:41.2157578Z Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=852538)
2017-08-16T15:44:41.2157578Z ==============================================================================
2017-08-16T15:44:42.2564137Z You are using a query match on the version string. Behavior changes or breaking changes might occur as NuGet updates to a new version.
2017-08-16T15:44:42.3644154Z Downloading: https://dist.nuget.org/win-x86-commandline/v4.3.0/nuget.exe
2017-08-16T15:44:42.4644166Z Caching tool: NuGet 4.3.0 x64
2017-08-16T15:44:42.4714159Z Using version: 4.3.0
2017-08-16T15:44:42.4724170Z Found tool in cache: NuGet 4.3.0 x64
2017-08-16T15:44:42.4724170Z Using tool path: d:\a\_tool\NuGet\4.3.0\x64
2017-08-16T15:44:42.4724170Z Prepending PATH environment variable with directory: d:\a\_tool\NuGet\4.3.0\x64
2017-08-16T15:44:42.4804171Z ##[section]Finishing: Use NuGet 4.x
2017-08-16T15:44:42.4824163Z ##[section]Starting: Restore
2017-08-16T15:44:42.4834169Z ==============================================================================
2017-08-16T15:44:42.4834169Z Task         : .NET Core
2017-08-16T15:44:42.4834169Z Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command. For package commands, supports NuGet.org and authenticated feeds like Package Management and MyGet.
2017-08-16T15:44:42.4834169Z Version      : 2.0.5
2017-08-16T15:44:42.4834169Z Author       : Microsoft Corporation
2017-08-16T15:44:42.4834169Z Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
2017-08-16T15:44:42.4834169Z ==============================================================================
2017-08-16T15:44:43.3298644Z SYSTEMVSSCONNECTION exists true
2017-08-16T15:44:43.3328644Z Saving NuGet.config to a temporary config file.
2017-08-16T15:44:43.3439930Z ##[warning]Can\'t find loc string for key: NGCommon_NoSourcesFoundInConfig
2017-08-16T15:44:43.3448653Z ##[warning]NGCommon_NoSourcesFoundInConfig d:\a\1\Nuget\tempNuGet_736.config
2017-08-16T15:44:43.3698655Z [command]"C:\Program Files\dotnet\dotnet.exe" restore d:\a\1\s\src\CommandStack\CommandStack.csproj --configfile d:\a\1\Nuget\tempNuGet_736.config --verbosity Detailed
2017-08-16T15:44:46.3920139Z   Restoring packages for d:\a\1\s\src\CommandStack\CommandStack.csproj...
2017-08-16T15:44:46.4455885Z C:\Program Files\dotnet\sdk\1.0.4\NuGet.targets(97,5): error : Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'. [d:\a\1\s\src\CommandStack\CommandStack.csproj]
2017-08-16T15:44:46.4704173Z   Generating MSBuild file d:\a\1\s\src\CommandStack\obj\CommandStack.csproj.nuget.g.props.
2017-08-16T15:44:46.4751984Z   Generating MSBuild file d:\a\1\s\src\CommandStack\obj\CommandStack.csproj.nuget.g.targets.
2017-08-16T15:44:46.4762048Z   Writing lock file to disk. Path: d:\a\1\s\src\CommandStack\obj\project.assets.json
2017-08-16T15:44:46.5172057Z   Restore failed in 79.89 ms for d:\a\1\s\src\CommandStack\CommandStack.csproj.
2017-08-16T15:44:46.5192052Z   
2017-08-16T15:44:46.5192052Z   Errors in d:\a\1\s\src\CommandStack\CommandStack.csproj
2017-08-16T15:44:46.5202059Z       Unable to resolve 'NETStandard.Library (>= 1.6.1)' for '.NETStandard,Version=v2.0'.
2017-08-16T15:44:46.5202059Z   
2017-08-16T15:44:46.5202059Z   NuGet Config files used:
2017-08-16T15:44:46.5202059Z       d:\a\1\Nuget\tempNuGet_736.config
2017-08-16T15:44:46.5552047Z ##[error]Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
2017-08-16T15:44:46.5552047Z ##[error]Packages failed to restore
2017-08-16T15:44:46.5622062Z ##[section]Finishing: Restore

@Liero sorry to hear that. The NuGet tool installer won't help at all here - you'll want the .NET Core Tool Installer task and .NET Core task for your scenario. You mentioned you'd tried the .NET Core Tool Installer but were still having issues. Did you use "2.0.0" for the Version field in that task? If so, could you share the output here? I'd expect that to have been able to resolve the issue you're seeing.

Actually, three steps vere required to make it work: https://stackoverflow.com/a/45739237/475727

I believe it could work by default without the three steps...

@Liero I saw your SO post(s) earlier today and tried them, and I still experience this error currently. I posted about it here: https://developercommunity.visualstudio.com/content/problem/159780/error-nu1100-unable-to-resolve-netstandardlibrary.html

I'm pretty sure the VS2017 hosted agent has the correct SDK bits, so it seems like the SDK version isn't the cause. However, I still don't really have much idea what would be causing it.

I've tried running my build in the following ways:

  • execute a FAKE script through the generated build.cmd via the Batch runner VSTS task
  • execute a dotnet restore using the .NET Core command VSTS task
  • execute the FAKE script using Isaac Abrams' F# helper extension which provides a "Run FAKE Build" task

All three approaches fail in the same way.

@aggieben,
Does your build task have a NET Core Tool Installer "2.0.0" [1] build step _before_ all of your other steps in the build?

[1]
image

@keithrob no - but like I said I verified in the output that the correct version of the SDK is being used (and in addition to that, I'm now using a global.json to ensure an error occurs if the correct version isn't available).

I did just figure this out, though. I'm using Paket to manage my dependencies and I neglected to add NETStandard.Library to my paket.dependencies file. So the root cause here was PEBKAC (problem exists between keyboard and chair). 馃槈

@aggieben,
Glad to hear the problem is resolved. Curious, can you explain how you verified the correct version of the SDK?

I verified in the output
image

I have same issue I fixed it by "Add https://api.nuget.org/ to trusted site on Internet Option"

Was this page helpful?
0 / 5 - 0 ratings