PackTask fails due to System.IO.Compression 4.1 not being found #4290

Open
AArnott opened this Issue Jan 15, 2017 · 17 comments

Comments

Projects
None yet
8 participants
@AArnott
Contributor

AArnott commented Jan 15, 2017

Details about Problem

VS version (if appropriate): Visual Studio 2017 d15rel 26114.0
OS version: win10 build 14393.rs1_release.161220-1747

Detailed repro steps so we can see the same problem

git clone https://github.com/microsoft/vs-validation.git
cd vs-validation
git checkout 114f31640
cd src\Microsoft.VisualStudio.Validation
msbuild /t:restore
msbuild /t:pack

Sometimes it fails with this error:

"C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj" (pack target) (1) ->
(GenerateNuspec target) -> 
  C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018: The "PackTask" task failed unexpectedly.\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'System.IO.Compression, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018: File name: 'System.IO.Compression, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at NuGet.Packaging.PackageBuilder.Save(Stream stream)\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at NuGet.Commands.PackCommandRunner.BuildPackage(PackageBuilder builder, String outputPath)\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at NuGet.Commands.PackCommandRunner.BuildPackage(String path)\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at NuGet.Commands.PackCommandRunner.BuildPackage()\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at NuGet.Build.Tasks.Pack.PackTaskLogic.BuildPackage(PackCommandRunner runner)\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at NuGet.Build.Tasks.Pack.PackTask.Execute()\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018: \r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018: WRN: Assembly binding logging is turned OFF.\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018: To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018: Note: There is some performance penalty associated with assembly bind failure logging.\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018: To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].\r [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]
C:\Program Files (x86)\Microsoft Visual Studio\2017\d15rel\MSBuild\Sdks\NuGet.Build.Tasks.Pack\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(89,5): error MSB4018:  [C:\git\validation\src\Microsoft.VisualStudio.Validation\Microsoft.VisualStudio.Validation.csproj]

msbuild.zip

@rohit21agrawal

This comment has been minimized.

Show comment
Hide comment
@rohit21agrawal

rohit21agrawal Jan 16, 2017

Contributor

cannot repro this in 26114.2 build and onwards.
@AArnott it would be great if you could verify this on your end too

Contributor

rohit21agrawal commented Jan 16, 2017

cannot repro this in 26114.2 build and onwards.
@AArnott it would be great if you could verify this on your end too

@rrelyea rrelyea modified the milestones: 4.0 RTM, 4.0 RC3 Jan 16, 2017

@AArnott

This comment has been minimized.

Show comment
Hide comment
@AArnott

AArnott Jan 17, 2017

Contributor

On d15rel 26115.1...
It doesn't repro when I try it repeatedly. But it only happened twice on the original build I reported out of a couple dozen uses. So I'm not sure this is definitive.

Contributor

AArnott commented Jan 17, 2017

On d15rel 26115.1...
It doesn't repro when I try it repeatedly. But it only happened twice on the original build I reported out of a couple dozen uses. So I'm not sure this is definitive.

@rohit21agrawal

This comment has been minimized.

Show comment
Hide comment
@rohit21agrawal

rohit21agrawal Jan 19, 2017

Contributor

closing this for now...please reactive if you see this repro in any newer builds.

Contributor

rohit21agrawal commented Jan 19, 2017

closing this for now...please reactive if you see this repro in any newer builds.

@AArnott

This comment has been minimized.

Show comment
Hide comment
@AArnott

AArnott May 10, 2017

Contributor

This is happening again, when using this version:

  <ItemGroup>
    <PackageReference Include="NuGet.Build.Tasks.Pack" Version="4.3.0-preview1-4045" PrivateAssets="all" />
  </ItemGroup>
C:\Users\andarno\.nuget\packages\nuget.build.tasks.pack\4.3.0-preview1-4045\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(141,5): error : Could not load file or assembly 'System.IO.Compression, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. [F:\git\DevCore\src\clr\hosts\Microsoft.ServiceHub.HostLib\Microsoft.ServiceHub.HostLib.csproj]

If NuGet Tasks are only built against .netstandard, then the bug here is probably this: dotnet/cli#6333 (comment)

The error I see is intermittent, and that's consistent with @rainersigwald's analysis in the linked bug as well.

Contributor

AArnott commented May 10, 2017

This is happening again, when using this version:

  <ItemGroup>
    <PackageReference Include="NuGet.Build.Tasks.Pack" Version="4.3.0-preview1-4045" PrivateAssets="all" />
  </ItemGroup>
C:\Users\andarno\.nuget\packages\nuget.build.tasks.pack\4.3.0-preview1-4045\buildCrossTargeting\NuGet.Build.Tasks.Pack.targets(141,5): error : Could not load file or assembly 'System.IO.Compression, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. [F:\git\DevCore\src\clr\hosts\Microsoft.ServiceHub.HostLib\Microsoft.ServiceHub.HostLib.csproj]

If NuGet Tasks are only built against .netstandard, then the bug here is probably this: dotnet/cli#6333 (comment)

The error I see is intermittent, and that's consistent with @rainersigwald's analysis in the linked bug as well.

@AArnott

This comment has been minimized.

Show comment
Hide comment
@AArnott

AArnott May 10, 2017

Contributor

It looks like the task assembly is compiled for net45, but its reference to System.IO.Compression,4.1.0.0 is not in the framework and can't be (reliably) found .

Contributor

AArnott commented May 10, 2017

It looks like the task assembly is compiled for net45, but its reference to System.IO.Compression,4.1.0.0 is not in the framework and can't be (reliably) found .

@AArnott

This comment has been minimized.

Show comment
Hide comment
@AArnott

AArnott May 10, 2017

Contributor

It looks like System.IO.Compression,4.0.0.0 is available in the GAC. Can you reference that in your net45 targeted Task assembly instead?

Contributor

AArnott commented May 10, 2017

It looks like System.IO.Compression,4.0.0.0 is available in the GAC. Can you reference that in your net45 targeted Task assembly instead?

@rohit21agrawal

This comment has been minimized.

Show comment
Hide comment
@rohit21agrawal

rohit21agrawal May 10, 2017

Contributor

@AArnott we don't have a direct dependency on System.IO.Compression , so i am not sure what we can do on our side to change 4.1.0 to 4.0.0 .
https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Build.Tasks.Pack.Library/NuGet.Build.Tasks.Pack.Library.csproj
It's actually the dependency on Netstandard.library which is brining in system.io.compression 4.1.0

image

Contributor

rohit21agrawal commented May 10, 2017

@AArnott we don't have a direct dependency on System.IO.Compression , so i am not sure what we can do on our side to change 4.1.0 to 4.0.0 .
https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Build.Tasks.Pack.Library/NuGet.Build.Tasks.Pack.Library.csproj
It's actually the dependency on Netstandard.library which is brining in system.io.compression 4.1.0

image

@AArnott

This comment has been minimized.

Show comment
Hide comment
@AArnott

AArnott May 24, 2017

Contributor

What's the status on this? It's blocking our ability to ship nuget packages (as it's the last blocker in a long chain of workarounds for other nuget bugs we're dealing with).

Contributor

AArnott commented May 24, 2017

What's the status on this? It's blocking our ability to ship nuget packages (as it's the last blocker in a long chain of workarounds for other nuget bugs we're dealing with).

@lauteala

This comment has been minimized.

Show comment
Hide comment
@lauteala

lauteala Jun 7, 2017

I have the same exact problem with System.IO.Compression with NuGet.Build.Tasks.Pack 4.3.0-preview1-4045!
--> No NuGets :/

lauteala commented Jun 7, 2017

I have the same exact problem with System.IO.Compression with NuGet.Build.Tasks.Pack 4.3.0-preview1-4045!
--> No NuGets :/

@rohit21agrawal

This comment has been minimized.

Show comment
Hide comment
@rohit21agrawal

rohit21agrawal Jun 7, 2017

Contributor

@lauteala @AArnott i have a fix out for this, but since i don't have a repro on my end, would you guys be willing to test private bits to see if the problem goes away for you? let me know and i will set you guys up.

Contributor

rohit21agrawal commented Jun 7, 2017

@lauteala @AArnott i have a fix out for this, but since i don't have a repro on my end, would you guys be willing to test private bits to see if the problem goes away for you? let me know and i will set you guys up.

@AArnott

This comment has been minimized.

Show comment
Hide comment
@AArnott

AArnott Jun 7, 2017

Contributor

Sure

Contributor

AArnott commented Jun 7, 2017

Sure

@rohit21agrawal

This comment has been minimized.

Show comment
Hide comment
@rohit21agrawal

rohit21agrawal Jun 7, 2017

Contributor

@AArnott have sent you a mail.

Contributor

rohit21agrawal commented Jun 7, 2017

@AArnott have sent you a mail.

@rrelyea

This comment has been minimized.

Show comment
Hide comment
@rrelyea

rrelyea Jun 27, 2017

Contributor

Doesn't look on track for 4.3 -- still haven't gotten right fix.

Contributor

rrelyea commented Jun 27, 2017

Doesn't look on track for 4.3 -- still haven't gotten right fix.

@KirillOsenkov

This comment has been minimized.

Show comment
Hide comment
@KirillOsenkov

KirillOsenkov Jul 6, 2017

MSBuild itself has recently added a dependency on System.Io.Compression and a binding redirect in msbuild.exe.config. Perhaps that will help?

MSBuild itself has recently added a dependency on System.Io.Compression and a binding redirect in msbuild.exe.config. Perhaps that will help?

@rohit21agrawal

This comment has been minimized.

Show comment
Hide comment
@rohit21agrawal

rohit21agrawal Jul 6, 2017

Contributor

@KirillOsenkov yeah looks like that would fix it. where is system.io.compression 4.1.2.0 shipped ?

Contributor

rohit21agrawal commented Jul 6, 2017

@KirillOsenkov yeah looks like that would fix it. where is system.io.compression 4.1.2.0 shipped ?

@AArnott

This comment has been minimized.

Show comment
Hide comment
@AArnott

AArnott Jul 6, 2017

Contributor

And what version MSBuild makes this change?

Contributor

AArnott commented Jul 6, 2017

And what version MSBuild makes this change?

@rainersigwald

This comment has been minimized.

Show comment
Hide comment
@rainersigwald

rainersigwald Jul 6, 2017

In dotnet/sdk#1384, @jp2masa reports that the binding redirect is insufficient.

@AArnott MSBuild 15.3.399 and higher should have the binding redirect for System.IO.Compression 4.1.2.0.

In dotnet/sdk#1384, @jp2masa reports that the binding redirect is insufficient.

@AArnott MSBuild 15.3.399 and higher should have the binding redirect for System.IO.Compression 4.1.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment