Cake.Powershell icon indicating copy to clipboard operation
Cake.Powershell copied to clipboard

Could not load Cake.Powershell.2.0.0\lib\net6.0\Cake.Powershell.dll (missing System.Management.Automation, Version=7.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)

Open ByteDev opened this issue 1 year ago • 4 comments

I was under the impression from the Cake Powershell page that Cake 2.0.0 is supported but when I run: dotnet cake build.cake I get the following error:

Could not load Z:\Dev\GitHub\MyProj\build\tools\Addins\Cake.Powershell.2.0.0\lib\net6.0\Cake.Powershell.dll (missing System.Management.Automation, Version=7.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)

I'm referencing Cake.Powershell via an addin in my cake file: #addin nuget:?package=Cake.Powershell&version=2.0.0.

Any idea of the problem? Any plans for Cake 3.0.0 support? Thanks

ByteDev avatar May 29 '23 10:05 ByteDev

解决了吗,我也碰到此问题,cake4.0

xiazhaozhao avatar Feb 02 '24 03:02 xiazhaozhao

I had the same issue with Cake.powershell 3.0.0 The package requires system.automation.7.3.3 and it has one of the dll missing

HariVamshi avatar Apr 26 '24 11:04 HariVamshi

Hi there!

That's an interesting bug and it would be great if someone could solve it for good. But it might not be an easy one.

I have created a dummy test project to reproduce the bug. It is available in a separate repository.

This allowed me to find a workaround for this bug. Feel free to try it out.

In a few words:

  1. Add a cake.config file with these few lines:
    [NuGet]
    LoadDependencies=true
    
  2. Instead of only adding Cake.Powershell in your cake script, also add Microsoft.PowerShell.Commands.Management version 7.4.3
    #addin nuget:?package=Cake.Powershell&version=3.0.0
    #addin nuget:?package=Microsoft.PowerShell.Commands.Management&version=7.4.3
    

reureu avatar Jun 21 '24 12:06 reureu

This bug seems to be resolved with Cake.PowerShell 4.0.0.

All you need to do is add Cake.PowerShell 4.0.0 as add-in with dependencies.

#addin nuget:?package=Cake.Powershell&version=4.0.0&loaddependencies=true

The &loaddependencies=true is required!

reureu avatar Jul 30 '24 08:07 reureu