ubisoft / Sharpmake

Sharpmake is an open-source C#-based solution for generating project definition files, such as Visual Studio projects and solutions, GNU makefiles, Xcode projects, etc.
Apache License 2.0
914 stars 164 forks source link

Compile.ps1 does not work on Windows (Powershell 5.1 Desktop) #286

Open GamingMinds-UlfW opened 11 months ago

GamingMinds-UlfW commented 11 months ago

Compile.ps1 (and all other scripts which use Join-Path e.g. RunSharpmake.ps1) do not work on the Windows platform (for me Windows 10 x64 22H2) with the default Powershell (5.1 Desktop).

The error output is something like this (this is just a sample using no parameters, when using seemingly correct parameter values the output is the same):

--- Compile , debug| with
working folder : E:\Source\Sharpmake
working folder : E:\Source\Sharpmake
msbuild compile
E:\Source\Sharpmake\Compile.ps1 : System.Management.Automation.ParameterBindingException: Es wurde kein
Positionsparameter gefunden, der das Argument "windows" akzeptiert.
   bei System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception
exception)
   bei System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   bei System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   bei System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
In Zeile:1 Zeichen:1
+ .\Compile.ps1
+ ~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Compile.ps1

The error occurs in line 202, due to Join-Path only accepting two arguments. Maybe I need to use a different powershell version, but I think the scripts should work with the default Powershell shipped with the OS.

sylvainfortin commented 11 months ago

Hi @GamingMinds-UlfW. Powershell scripts were added recently. Although it would be nice if it could work out of the box on Windows, we choose the latest version of Powershell (pwsh) because of its multi-platforms support. Keep in mind that Sharpmake can also be run on Linux and Mac environments.

That being said. If you think these scripts can be changed in a way that they could be used on both version of Powershell you can open a pull request.