question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Restore fails if netstandard1.x package reference is present

See original GitHub issue

SDK version: 3.0.100-preview4-010963

repro:

  Persisting no-op dg to C:\dev\RssBandit\source\ChildProjects\IEControl\obj\IEControl.csproj.nuget.dgspec.json
  Persisting no-op dg to C:\dev\RssBandit\source\RssBandit.AppServices\obj\RssBandit.AppServices.csproj.nuget.dgspec.json
  Persisting no-op dg to C:\dev\RssBandit\source\NewsComponents\obj\NewsComponents.csproj.nuget.dgspec.json
  Persisting no-op dg to C:\dev\RssBandit\source\RssBandit\obj\RssBandit.csproj.nuget.dgspec.json
  Restore completed in 22.85 ms for C:\dev\RssBandit\source\RssBandit.AppServices\RssBandit.AppServices.csproj.
  Restore completed in 22.83 ms for C:\dev\RssBandit\source\ChildProjects\IEControl\IEControl.csproj.
  Restore completed in 26.1 ms for C:\dev\RssBandit\source\NewsComponents\NewsComponents.csproj.
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Runtime.InteropServices from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Console 4.0.0 -> runtime.win.System.Console 4.3.0 -> System.Runtime.InteropServices (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Runtime.InteropServices (>= 4.1.0)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Runtime.Extensions from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.IO.FileSystem 4.0.1 -> runtime.win.System.IO.FileSystem 4.3.0 -> System.Runtime.Extensions (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Runtime.Extensions (>= 4.1.0)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Runtime.InteropServices from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.IO.FileSystem 4.0.1 -> runtime.win.System.IO.FileSystem 4.3.0 -> System.Runtime.InteropServices (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Runtime.InteropServices (>= 4.1.0)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.IO.FileSystem from 4.3.0 to 4.0.1. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Net.Sockets 4.1.0 -> runtime.win.System.Net.Sockets 4.3.0 -> System.IO.FileSystem (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.IO.FileSystem (>= 4.0.1)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Net.NameResolution from 4.3.0 to 4.0.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Net.Sockets 4.1.0 -> runtime.win.System.Net.Sockets 4.3.0 -> System.Net.NameResolution (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Net.NameResolution (>= 4.0.0)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Net.Primitives from 4.3.0 to 4.0.11. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Net.Sockets 4.1.0 -> runtime.win.System.Net.Sockets 4.3.0 -> System.Net.Primitives (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Net.Sockets 4.1.0 -> System.Net.Primitives (>= 4.0.11)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Runtime.Extensions from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Net.Sockets 4.1.0 -> runtime.win.System.Net.Sockets 4.3.0 -> System.Runtime.Extensions (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Runtime.Extensions (>= 4.1.0)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Runtime.InteropServices from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Net.Sockets 4.1.0 -> runtime.win.System.Net.Sockets 4.3.0 -> System.Runtime.InteropServices (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Runtime.InteropServices (>= 4.1.0)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Runtime.InteropServices from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Diagnostics.Process 4.1.0 -> Microsoft.Win32.Primitives 4.0.1 -> runtime.win.Microsoft.Win32.Primitives 4.3.0 -> System.Runtime.InteropServices (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Runtime.InteropServices (>= 4.1.0)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Runtime.InteropServices from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.IO.FileSystem.Watcher 4.0.0 -> Microsoft.Win32.Primitives 4.0.1 -> runtime.win.Microsoft.Win32.Primitives 4.3.0 -> System.Runtime.InteropServices (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Runtime.InteropServices (>= 4.1.0)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Runtime.Extensions from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Net.NameResolution 4.0.0 -> System.Net.Primitives 4.0.11 -> runtime.win.System.Net.Primitives 4.3.0 -> System.Runtime.Extensions (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Runtime.Extensions (>= 4.1.0)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Runtime.InteropServices from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Net.NameResolution 4.0.0 -> System.Net.Primitives 4.0.11 -> runtime.win.System.Net.Primitives 4.3.0 -> System.Runtime.InteropServices (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Runtime.InteropServices (>= 4.1.0)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Runtime.Extensions from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Net.Requests 4.0.11 -> System.Net.Primitives 4.0.11 -> runtime.win.System.Net.Primitives 4.3.0 -> System.Runtime.Extensions (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Runtime.Extensions (>= 4.1.0)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Runtime.InteropServices from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Net.Requests 4.0.11 -> System.Net.Primitives 4.0.11 -> runtime.win.System.Net.Primitives 4.3.0 -> System.Runtime.InteropServices (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Runtime.InteropServices (>= 4.1.0)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Runtime.Extensions from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Net.Sockets 4.1.0 -> System.Net.Primitives 4.0.11 -> runtime.win.System.Net.Primitives 4.3.0 -> System.Runtime.Extensions (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Runtime.Extensions (>= 4.1.0)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Runtime.InteropServices from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Net.Sockets 4.1.0 -> System.Net.Primitives 4.0.11 -> runtime.win.System.Net.Primitives 4.3.0 -> System.Runtime.InteropServices (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Runtime.InteropServices (>= 4.1.0)
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605: Detected package downgrade: System.Runtime.InteropServices from 4.3.0 to 4.1.0. Reference the package directly from the project to select a different version. 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Net.NameResolution 4.0.0 -> System.Security.Principal.Windows 4.0.0 -> Microsoft.Win32.Primitives 4.0.1 -> runtime.win.Microsoft.Win32.Primitives 4.3.0 -> System.Runtime.InteropServices (>= 4.3.0) 
C:\dev\RssBandit\source\RssBandit\RssBandit.csproj : error NU1605:  RssBandit -> NewsComponents -> log4net 2.0.8 -> System.Runtime.InteropServices (>= 4.1.0)
  Restore failed in 467.8 ms for C:\dev\RssBandit\source\RssBandit\RssBandit.csproj.

EDIT by @dsplaisted: This is the workaround for this bug:

<PackageReference Include="Microsoft.NETCore.Targets" Version="2.1.0" ExcludeAssets="all" PrivateAssets="all" />

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:33 (20 by maintainers)

github_iconTop GitHub Comments

5reactions
dsplaistedcommented, Jun 4, 2019

A better workaround than adding a reference to Microsoft.NETCore.App is probably to reference Microsoft.NETCore.Targets:

<PackageReference Include="Microsoft.NETCore.Targets" Version="2.1.0" ExcludeAssets="all" PrivateAssets="all" />
4reactions
dsplaistedcommented, May 2, 2019

It’s also possible to hit this if you end up with dependencies on contracts from different “bands” of .NET Core 1.x. log4net happens to have these dependencies directly, but it could happen with other combinations of packages. These references also cause the issue:

    <PackageReference Include="System.IO.FileSystem" Version="4.0.1" />
    <PackageReference Include="System.Reflection" Version="4.3.0" />

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuget fails to restore NetStandard.Libary for netstandard1. ...
I managed to reproduce your issue after clear the nuget cache in my build agent. And the solution to fix this issue is...
Read more >
Troubleshooting NuGet Package Restore in Visual Studio
This error occurs when you attempt to build a project that contains references to one or more NuGet packages, but those packages are...
Read more >
Please stop lying about .NET Standard 2.0 support!
In this post I have a bit of a rant about Microsoft's NuGet packages lying about supporting .NET Standard 2.0 when they kinda...
Read more >
Msbuild cannot find references. framwork. Check both of these a
Here's where it fails, just after opening the project I get the error: Microsoft. If those references are found on a given machine...
Read more >
[REGRESSION] Package restore not working as expected
Instead, the old reference versions are just used. Manually using the Restore option in the Nuget tab shows immediately, that all packages did...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found