Skip to content

Commit

Permalink
Update build.* files
Browse files Browse the repository at this point in the history
- Update build.ps1 to compute target framework from .NET SDK list
- Delete build.cmd, user powershell script on windows
  • Loading branch information
mysticmind committed Nov 21, 2023
1 parent a09a777 commit a377991
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
12 changes: 0 additions & 12 deletions build.cmd

This file was deleted.

21 changes: 15 additions & 6 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
$ErrorActionPreference = "Stop";
$version = dotnet --version;
if ($version.StartsWith("6.")) {

$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 ($version.StartsWith("7.")) {
}
elseif ($item.Value.StartsWith("7.")) {
$target_framework = "net7.0"
}
}
else {
Write-Output "BUILD FAILURE: .NET 6, .NET 7 SDK required to run build"

if ([string]::IsNullOrEmpty($target_framework)) {
Write-Output "BUILD FAILURE: .NET 6 or .NET 7 SDK required to run build"
exit 1
}

Write-Output "Using $target_framework"
dotnet run --project build/build.csproj -f $target_framework -c Release -- $args

0 comments on commit a377991

Please sign in to comment.