Packaging fails after updating dotnet sdk to 2.1.403 #43

Closed
opened 2026-01-29 16:27:55 +00:00 by claunia · 3 comments
Owner

Originally created by @matthid on GitHub (Oct 5, 2018).

In particular the build fails since d0cda20528 and the only relevant change there seems to be the 402 -> 403 update (which I have confirmed locally).

The issue seems to happen if you use a "local" dotnet cli installation via script (not via installer) combined with a global installation of a different version.

Reproducing the issue

Repro:

  1. Uninstall all dotnet SDK versions
  2. Install 2.1.402 (which is the version installed globally on appveyor at the time of writing)
  3. Run the following code
git clone https://github.com/fsharp/FAKE.git
git checkout 649cb005ffe3c7438167d6439bff822cdc1fdac9
dotnet tool install -g fake-cli
fake build -st DotNetCoreCreateDebianPackage

The script will download and install a local "dotnet sdk" with the version 2.1.403 (as it notices that only 2.1.402 is installed globally). After downloading it will invoke the msbuild target (you can run the printed msbuild command standalone)

Expected result

works

Actual result

  Creating DEB package 'C:\proj\FAKE\src\app\fake-cli\bin\Release\netcoreapp2.1\linux-x64\fake-cli.5.8.3.linux-x64.deb' from folder 'bin\Release\netcoreapp2.1\linux-x64\publish\'
C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018: The "DebTask" task failed unexpectedly. [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj]
C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018: System.TypeInitializationException: The type initializer for 'Packaging.Targets.IO.NativeMethods' threw an exception. ---> System.IO.FileLoadException: Could not load liblzma. On Linux, make sure you've installed liblzma-dev or an equivalent package. [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj]
C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018:    at Packaging.Targets.IO.NativeMethods..cctor() [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj]
C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018:    --- End of inner exception stack trace --- [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj]
C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018:    at Packaging.Targets.IO.NativeMethods.lzma_easy_encoder(LzmaStream& stream, UInt32 preset, LzmaCheck check) [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj]
C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018:    at Packaging.Targets.IO.XZOutputStream..ctor(Stream s, Int32 threads, UInt32 preset, Boolean leaveOpen) [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj]
C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018:    at Packaging.Targets.DebTask.Execute() [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj]
C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj]
C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj]

Workaround

Do not use locally installed dotnet cli version?

Originally created by @matthid on GitHub (Oct 5, 2018). In particular the build fails since https://github.com/fsharp/FAKE/pull/2116/commits/d0cda205282ce43f3090a53426d305fdde615b7e and the only relevant change there seems to be the 402 -> 403 update (which I have confirmed locally). The issue seems to happen if you use a "local" dotnet cli installation via script (not via installer) combined with a global installation of a different version. ## Reproducing the issue Repro: 1. Uninstall all dotnet SDK versions 2. Install 2.1.402 (which is the version installed globally on appveyor at the time of writing) 3. Run the following code ``` git clone https://github.com/fsharp/FAKE.git git checkout 649cb005ffe3c7438167d6439bff822cdc1fdac9 dotnet tool install -g fake-cli fake build -st DotNetCoreCreateDebianPackage ``` The script will download and install a local "dotnet sdk" with the version 2.1.403 (as it notices that only 2.1.402 is installed globally). After downloading it will invoke the msbuild target (you can run the printed msbuild command standalone) ## Expected result works ## Actual result ``` Creating DEB package 'C:\proj\FAKE\src\app\fake-cli\bin\Release\netcoreapp2.1\linux-x64\fake-cli.5.8.3.linux-x64.deb' from folder 'bin\Release\netcoreapp2.1\linux-x64\publish\' C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018: The "DebTask" task failed unexpectedly. [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj] C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018: System.TypeInitializationException: The type initializer for 'Packaging.Targets.IO.NativeMethods' threw an exception. ---> System.IO.FileLoadException: Could not load liblzma. On Linux, make sure you've installed liblzma-dev or an equivalent package. [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj] C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018: at Packaging.Targets.IO.NativeMethods..cctor() [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj] C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018: --- End of inner exception stack trace --- [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj] C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018: at Packaging.Targets.IO.NativeMethods.lzma_easy_encoder(LzmaStream& stream, UInt32 preset, LzmaCheck check) [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj] C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018: at Packaging.Targets.IO.XZOutputStream..ctor(Stream s, Int32 threads, UInt32 preset, Boolean leaveOpen) [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj] C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018: at Packaging.Targets.DebTask.Execute() [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj] C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj] C:\Users\matth\.nuget\packages\packaging.targets\0.1.48\build\Packaging.Targets.targets(90,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\proj\FAKE\src\app\fake-cli\fake-cli.fsproj] ``` ## Workaround Do not use locally installed dotnet cli version?
Author
Owner

@matthid commented on GitHub (Apr 22, 2019):

I just hit this again. Using a global installation still is the workaround...

@matthid commented on GitHub (Apr 22, 2019): I just hit this again. Using a global installation still is the workaround...
Author
Owner

@qmfrederik commented on GitHub (May 2, 2019):

@matthid That's an interesting corner case. I've released an update a couple of days ago which packages dotnet-deb as a global .NET Core CLI tool.

Can you give that a try and let me know if it fixes the issue? If not, there are some other things we can try.

@qmfrederik commented on GitHub (May 2, 2019): @matthid That's an interesting corner case. I've released an update a couple of days ago which packages `dotnet-deb` as a global .NET Core CLI tool. Can you give that a try and let me know if it fixes the issue? If not, there are some other things we can try.
Author
Owner

@qmfrederik commented on GitHub (Jun 16, 2019):

I'm closing this as we now ship this as a global tool. Let me know if this is not fixed.

@qmfrederik commented on GitHub (Jun 16, 2019): I'm closing this as we now ship this as a global tool. Let me know if this is not fixed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/dotnet-packaging#43