Cake.Powershell
Cake.Powershell copied to clipboard
Cake tool error missing System.Management.Automation, Version=7.1.2.0
Hi, Just want to say thanks for this project!
I saw you updated the powershell addin and just gave it a go and but seem to be getting this error
D:\dev\code\blah\[master ≡ +0 ~1 -1 !]> dotnet cake
Could not load D:\dev\code\blah\tools\Addins\Cake.Powershell.1.0.0\lib\net5.0\Cake.Powershell.dll (missing System.Management.Automation, Version=7.1.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
I tried adding System.Management.Automation
as a tool but made no difference.
Not sure what I'm doing incorrectly.
hi when you add as addin Cake.Powershell do you also add &loaddependencies=true ?
No I don't. Did not know about that. Will try when I'm back on my computer and let you know! Thanks!
I've added System.Management.Automation
back to the net46 in v1.0.1
, hopefully that solves the problem for you.
I've just double checked this and it works with &loaddependencies=true
I've tested in
PowerShell 7.1.2 & 5.1.19041.610
dotnet cake 1.1.0
With #addin "Cake.Powershell"
I get
Could not load D:\dev\blah\blah\tools\Addins\Cake.Powershell.1.0.1\lib\net5.0\Cake.Powershell.dll (missing System.Management.Automation, Version=7.1.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
D:/dev/blah/blah/build.cake(166,17): error CS0103: The name 'StartPowershellFile' does not exist in the current context
With #addin nuget:?package=Cake.Powershell&loaddependencies=true
It works
Hi, we're using .NET 5, and I just want to continue a little on this thread - adding &loaddependencies=true
actually pulls enormous amount of packages under /tools/addins
- around 500Mb.
I'm wondering if there is any way to avoid specifying &loaddependencies=true
.
Thank you!
@alex-tsbk did you ever find a solution for this? Just hit the same problem with Cake 2.1.0....
@antonysmith-mando how did you solve this? having the 500mb dependencies bundled for a deployment via cake is not nice..
Solved it by using: #addin nuget:?package=System.Management.Automation&version=7.2.6 #addin nuget:?package=Microsoft.ApplicationInsights&version=2.21.0 #addin nuget:?package=Microsoft.PowerShell.CoreCLR.Eventing&version=7.2.6 #addin nuget:?package=Cake.Powershell&version=2.0.0
Solved it by using: #addin nuget:?package=System.Management.Automation&version=7.2.6 #addin nuget:?package=Microsoft.ApplicationInsights&version=2.21.0 #addin nuget:?package=Microsoft.PowerShell.CoreCLR.Eventing&version=7.2.6 #addin nuget:?package=Cake.Powershell&version=2.0.0
It can be even shorter: #addin nuget:?package=System.Management.Automation&version=7.2.1 #addin nuget:?package=Microsoft.PowerShell.CoreCLR.Eventing&version=7.2.1 #addin nuget:?package=Cake.Powershell&version=2.0.0
I reckon this bug is resolved in Cake.PowerShell 4.0.0, same as #95.
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!
Can you please try?