NLog: "The package 'NLog' tried to add a framework reference to 'System.IO.Compression' which was not found in the GAC. This is possibly a bug in the package."

Type (choose one):

  • Bug

NLog version: (e.g. 4.2.3) 5.0.0-beta09

Platform: .NET Framework 4.7

Issue

When installing the NuGet package of 5.0.0-beta09 to my .NET Framework 4.7 unit test project, I get the following error:

Attempting to gather dependency information for package 'NLog.5.0.0-beta09' with respect to project 'Tests.NetFramework', targeting '.NETFramework,Version=v4.7'
Gathering dependency information took 662,02 ms
Attempting to resolve dependencies for package 'NLog.5.0.0-beta09' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'NLog.5.0.0-beta09'
Resolved actions to install package 'NLog.5.0.0-beta09'
Found package 'NLog 5.0.0-beta09' in 'C:\Source\Toolkit\packages'.
Package 'NLog.5.0.0-beta09' already exists in folder 'C:\Source\Toolkit\packages'
Install failed. Rolling back...
Package 'NLog.5.0.0-beta09' does not exist in project 'Tests.NetFramework'
Executing nuget actions took 1,1 sec
Failed to add reference. The package 'NLog' tried to add a framework reference to 'System.IO.Compression' which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance.
  Reference unavailable.
Time Elapsed: 00:00:01.7830560
========== Finished ==========

I thereby contact the package owners for assistance!

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 30 (18 by maintainers)

Commits related to this issue

Most upvoted comments

@sandersaares Yes I can reproduce the issue. If I manually add the following references to the test-project before installing NLog as nuget, then it works fine:

System.IO.Compression System.IO.Compression.FileSystem

I think the correct solution is to add the following option to your test-project before installing NLog-nuget-package (Should be done for all full NetFramework-projects that references NetStandard-projects):

<RestoreProjectStyle>PackageReference</RestoreProjectStyle>

See also: https://www.hanselman.com/blog/ReferencingNETStandardAssembliesFromBothNETCoreAndNETFramework.aspx

Manually installing System.IO.Compression from NuGet beforehand appears to work around this issue.