imradv3 / src /Setup /build_installer.ps1
fasdfsa's picture
调整项目名,打包名
1c117c2
$ErrorActionPreference = "Stop"
# Define paths
$projectPath = Join-Path $PSScriptRoot "..\WpfEditor\EchoDict.csproj"
$publishDir = Join-Path $PSScriptRoot "..\WpfEditor\bin\Release\net8.0-windows\win-x64\publish"
# 1. Publish the application
Write-Host "Publishing EchoDict..."
dotnet publish $projectPath -c Release -r win-x64 --self-contained false -o $publishDir
if ($LASTEXITCODE -ne 0) {
Write-Error "Publish failed with exit code $LASTEXITCODE"
}
# 2. Build the WiX project
# Note: This requires internet access to restore WixToolset.Sdk
Write-Host "Building MSI Installer..."
dotnet build (Join-Path $PSScriptRoot "Setup.wixproj") -c Release
if ($LASTEXITCODE -ne 0) {
Write-Error "WiX Build failed with exit code $LASTEXITCODE"
}
Write-Host "Build Complete. MSI should be in bin\Release\"