Compare commits
2 Commits
ba0d08a89e
...
0643209039
| Author | SHA1 | Date | |
|---|---|---|---|
| 0643209039 | |||
| 96134eab9d |
17
src/dotnet_build_script.bat
Normal file
17
src/dotnet_build_script.bat
Normal 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
|
||||
39
src/dotnet_build_script.ps1
Normal file
39
src/dotnet_build_script.ps1
Normal 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!"
|
||||
Loading…
Reference in New Issue
Block a user