forked from JasperFx/marten
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
executable file
·26 lines (22 loc) · 709 Bytes
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$ErrorActionPreference = "Stop";
$target_framework = ""
$dotnet_sdks = dotnet --list-sdks
$pattern = "\d+\.\d+\.\d+"
$versions = [regex]::Matches($dotnet_sdks, $pattern)
foreach ($item in $versions) {
if ($item.Value.StartsWith("6.")) {
$target_framework = "net6.0"
}
elseif ($item.Value.StartsWith("7.")) {
$target_framework = "net7.0"
}
elseif ($item.Value.StartsWith("8.")) {
$target_framework = "net8.0"
}
}
if ([string]::IsNullOrEmpty($target_framework)) {
Write-Output "BUILD FAILURE: .NET 6, .NET 7 or .NET 8 SDK required to run build"
exit 1
}
Write-Output "Using $target_framework"
dotnet run --project build/build.csproj -f $target_framework -c Release -- $args