Update: The actual cause of the issue was the '\' being round the wrong way, should have been './GenerateNuspecFile.ps1' - weird thing with F# parsing.
I am unable to run a ps1 script file from F# FAKE.
Question here which works well for running a chocolatey cpack
#r "packages/FAKE.3.12.2/tools/FakeLib.dll"
#r "System.Management.Automation"
#r "System.Core.dll"
open Fake
open System.Management.Automation
...
Target "GenerateNuspecFile" <| fun _ ->
PowerShell.Create()
.AddScript("Invoke-Command -ScriptBlock { cd './chocolatey' | iex .\GenerateNuspecFile.ps1 }")
.Invoke()
|> Seq.iter (printfn "%O")
...
This is not actually running the script file that I am trying to run. Set-ExecutionPolicy is "unrestricted"
Your powershell script has some issues, and would not work even if run from the command line.
In particular,
cd .\somedir | iex .\SomeScript.ps1is nonsensical - you are piping the result of acd(which is$null, sincecddoesn't return anything) toInvoke-Expression, which is basically saying "run this $null as a script.".Invoke-Commandshould not be needed at all.If your goal is simply to run
GenerateNuSpecFile.ps1, your script should just be:Or