-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild.ps1
More file actions
26 lines (19 loc) · 759 Bytes
/
build.ps1
File metadata and controls
26 lines (19 loc) · 759 Bytes
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
$solutionDir = Get-Location
$buildDir = "$solutionDir\builds"
# Ensure the builds directory exists
if (!(Test-Path -Path $buildDir)) {
New-Item -ItemType Directory -Path $buildDir | Out-Null
}
# Get all project files in the solution
$projects = dotnet sln list | Select-Object -Skip 2
# Define target runtimes
$runtimes = @("win-x64", "linux-x64")
foreach ($project in $projects) {
$projectName = [System.IO.Path]::GetFileNameWithoutExtension($project)
foreach ($runtime in $runtimes) {
$outputPath = "$buildDir\$projectName\$runtime"
Write-Host "Publishing $project for $runtime to $outputPath..."
dotnet publish $project -c Release --self-contained -r $runtime -o $outputPath
}
}
Write-Host "Build completed!"