2021-12-04 14:53:20 +02:00
|
|
|
#! /usr/bin/env pwsh
|
|
|
|
|
2021-12-06 16:27:05 +02:00
|
|
|
$platform = [System.Environment]::OSVersion.platform
|
|
|
|
if ($platform -eq 4) {
|
|
|
|
$default = 1
|
|
|
|
}
|
|
|
|
elseif ($platform -le 2) {
|
|
|
|
$default = 0
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$default = -1
|
|
|
|
}
|
|
|
|
|
2021-12-04 14:53:20 +02:00
|
|
|
$options = @("&Windows", "&Linux")
|
|
|
|
$choice = $host.UI.PromptForChoice(
|
|
|
|
"Compile exe",
|
|
|
|
"What OS to compile the executable for?",
|
|
|
|
$options,
|
2021-12-06 16:27:05 +02:00
|
|
|
$default
|
2021-12-04 14:53:20 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
$platform = $null
|
|
|
|
switch ($choice) {
|
|
|
|
0 { $platform = "win-x64" }
|
|
|
|
1 { $platform = "linux-x64" }
|
|
|
|
Default {
|
|
|
|
Write-Host "No OS chosen, exiting."
|
|
|
|
Exit
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$sc = $null
|
|
|
|
switch ($host.UI.PromptForChoice(
|
|
|
|
"Self Contained",
|
|
|
|
"Should the executable be runnable without installing .NET Runtime?",
|
|
|
|
@("&Yes", "&No"),
|
|
|
|
0)) {
|
|
|
|
0 { $sc = "true" }
|
|
|
|
1 { $sc = "false" }
|
|
|
|
}
|
|
|
|
|
|
|
|
dotnet publish -r $platform --self-contained $sc
|