# Run the Before.Console demo app (src/Before.Console/Program.cs) on Windows. # # Windows counterpart of scripts/run-console.sh: # - runs from the repo root, like the other scripts # - prefers mise (see mise.toml) and falls back to a dotnet on PATH # # Troubleshooting: if dotnet fails with "The user's home directory could not # be determined" (some sandboxed shells), set DOTNET_CLI_HOME first: # PS> $env:DOTNET_CLI_HOME = "$PWD\.dotnet-cli" # # Usage (from anywhere): # PS> .\scripts\run-console.ps1 # no args # PS> .\scripts\run-console.ps1 --verbose # args go to the program # The script inserts the `--` separator for dotnet run itself. # # If script execution is blocked by policy: # PS> powershell -ExecutionPolicy Bypass -File .\scripts\run-console.ps1 $ErrorActionPreference = 'Stop' $repoRoot = Split-Path -Parent $PSScriptRoot Push-Location $repoRoot try { $dotnetArgs = @('run', '--project', 'src/Before.Console') if ($args.Count -gt 0) { $dotnetArgs += '--' $dotnetArgs += $args } if (Get-Command mise -ErrorAction SilentlyContinue) { mise exec -- dotnet @dotnetArgs } else { dotnet @dotnetArgs } exit $LASTEXITCODE } finally { Pop-Location }