Initial commit
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
param(
|
||||
[ValidateSet('Debug', 'Release')]
|
||||
[string]$Configuration = 'Release',
|
||||
[switch]$SkipRestore
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
$dotnetExe = Join-Path $projectRoot '.tools\dotnet\dotnet.exe'
|
||||
$nugetConfig = Join-Path $projectRoot 'NuGet.Config'
|
||||
$outputRoot = Join-Path $projectRoot 'artifacts\WindowsToolbox'
|
||||
|
||||
if (-not (Test-Path -LiteralPath $dotnetExe)) {
|
||||
throw 'Local .NET SDK was not found under .tools\dotnet.'
|
||||
}
|
||||
|
||||
$env:DOTNET_CLI_HOME = Join-Path $projectRoot '.tools\dotnet-home'
|
||||
$env:NUGET_PACKAGES = Join-Path $projectRoot '.tools\nuget'
|
||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = '1'
|
||||
$env:DOTNET_CLI_TELEMETRY_OPTOUT = '1'
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $outputRoot | Out-Null
|
||||
|
||||
if (-not $SkipRestore) {
|
||||
& $dotnetExe restore (Join-Path $projectRoot 'WindowsToolbox.sln') --configfile $nugetConfig
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Restore failed.' }
|
||||
}
|
||||
|
||||
$commonArguments = @(
|
||||
'--configuration', $Configuration,
|
||||
'--framework', 'net8.0-windows',
|
||||
'--self-contained', 'false',
|
||||
'--no-restore',
|
||||
'--output', $outputRoot,
|
||||
'-p:DebugType=None',
|
||||
'-p:DebugSymbols=false'
|
||||
)
|
||||
|
||||
& $dotnetExe publish (Join-Path $projectRoot 'src\WindowsToolbox.ElevatedHost\WindowsToolbox.ElevatedHost.csproj') @commonArguments
|
||||
if ($LASTEXITCODE -ne 0) { throw 'Elevated host publish failed.' }
|
||||
|
||||
& $dotnetExe publish (Join-Path $projectRoot 'src\WindowsToolbox.Cli\WindowsToolbox.Cli.csproj') @commonArguments
|
||||
if ($LASTEXITCODE -ne 0) { throw 'CLI publish failed.' }
|
||||
|
||||
& $dotnetExe publish (Join-Path $projectRoot 'src\WindowsToolbox.App\WindowsToolbox.App.csproj') @commonArguments
|
||||
if ($LASTEXITCODE -ne 0) { throw 'WPF app publish failed.' }
|
||||
|
||||
Copy-Item -LiteralPath (Join-Path $projectRoot 'README.md') -Destination (Join-Path $outputRoot 'README.md') -Force
|
||||
|
||||
Write-Host "Published to: $outputRoot" -ForegroundColor Green
|
||||
Write-Host 'Run WindowsToolbox.App.exe to start.' -ForegroundColor Green
|
||||
Reference in New Issue
Block a user