Compare commits

...

2 Commits

2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,17 @@
@echo off
:: Set PowerShell script path
set SCRIPT_PATH="%~dp0dotnet_build_script.ps1"
:: Check if PowerShell script exists
if not exist %SCRIPT_PATH% (
echo PowerShell script not found: %SCRIPT_PATH%
exit /b 1
)
:: Execute PowerShell script
PowerShell -NoProfile -ExecutionPolicy Bypass -File %SCRIPT_PATH%
:: Pause to keep the window open
echo.
pause

View File

@ -0,0 +1,39 @@
# Define project path
$projectPath = "./YourProject.csproj"
# List of runtime identifiers for self-contained deployments
$runtimes = @(
"win-x64"
)
# Define build configurations
$configurations = @(
"Release"
)
# Output directory
$outputDir = "./build_outputs"
# Clean output directory if exists, then recreate it
if (Test-Path -Path $outputDir) {
Remove-Item -Recurse -Force -Path $outputDir
}
New-Item -ItemType Directory -Path $outputDir
# Build "normal" binaries (framework-dependent)
foreach ($config in $configurations) {
$normalBinOutput = "$outputDir/normal/$config"
dotnet publish $projectPath -c $config -o $normalBinOutput --self-contained false
Write-Output "Built normal bin for configuration: $config"
}
# Build "self-contained" binaries for multiple runtimes
foreach ($config in $configurations) {
foreach ($runtime in $runtimes) {
$selfContainedOutput = "$outputDir/self-contained/$config/$runtime"
dotnet publish $projectPath -c $config -r $runtime --self-contained true -o $selfContainedOutput
Write-Output "Built self-contained bin for configuration: $config, runtime: $runtime"
}
}
Write-Output "Build process completed!"