修复打包脚本
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
<!-- INSTALLER_DISPLAY_NAME - Name used when copying files to the Webupdater location. UPPER CASE with spaces-->
|
<!-- INSTALLER_DISPLAY_NAME - Name used when copying files to the Webupdater location. UPPER CASE with spaces-->
|
||||||
|
|
||||||
<?define DEFAULT_PRODUCT_NAME="XplorePlane"?>
|
<?define DEFAULT_PRODUCT_NAME="XplorePlane"?>
|
||||||
<?define DEFAULT_RELEASE_YEAR="2024"?>
|
<?define DEFAULT_RELEASE_YEAR="2026"?>
|
||||||
<?define DEFAULT_INSTALLER_DISPLAY_NAME="IDE"?>
|
<?define DEFAULT_INSTALLER_DISPLAY_NAME="IDE"?>
|
||||||
|
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
<?define DEFAULT_FOUNDATION_MAJOR_VERSION_NUMBER="4"?> <!--某年的结尾 -->
|
<?define DEFAULT_FOUNDATION_MAJOR_VERSION_NUMBER="4"?> <!--某年的结尾 -->
|
||||||
<?define DEFAULT_FOUNDATION_MINOR_VERSION_NUMBER="1"?> <!--第几季度 -->
|
<?define DEFAULT_FOUNDATION_MINOR_VERSION_NUMBER="1"?> <!--第几季度 -->
|
||||||
|
|
||||||
<?define DEFAULT_FOUNDATION_VERSION_NAME="2024.1"?>
|
<?define DEFAULT_FOUNDATION_VERSION_NAME="2026.1"?>
|
||||||
|
|
||||||
|
|
||||||
<!--============================= -->
|
<!--============================= -->
|
||||||
|
|||||||
+29
-1
@@ -135,6 +135,20 @@ function Rename-ExistingMsi {
|
|||||||
catch {
|
catch {
|
||||||
throw "无法读取旧 MSI 的 ProductVersion:$legacyMsi。$($_.Exception.Message)"
|
throw "无法读取旧 MSI 的 ProductVersion:$legacyMsi。$($_.Exception.Message)"
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
# Windows Installer COM objects keep the MSI open until every RCW is released.
|
||||||
|
foreach ($comObject in @($record, $view, $database, $installer)) {
|
||||||
|
if ($null -ne $comObject) {
|
||||||
|
[void][Runtime.InteropServices.Marshal]::FinalReleaseComObject($comObject)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$record = $null
|
||||||
|
$view = $null
|
||||||
|
$database = $null
|
||||||
|
$installer = $null
|
||||||
|
[GC]::Collect()
|
||||||
|
[GC]::WaitForPendingFinalizers()
|
||||||
|
}
|
||||||
|
|
||||||
if ([string]::IsNullOrWhiteSpace($oldVersion)) {
|
if ([string]::IsNullOrWhiteSpace($oldVersion)) {
|
||||||
throw "旧 MSI 未包含有效的 ProductVersion:$legacyMsi"
|
throw "旧 MSI 未包含有效的 ProductVersion:$legacyMsi"
|
||||||
@@ -145,7 +159,21 @@ function Rename-ExistingMsi {
|
|||||||
throw "旧 MSI 的版本化文件已存在,为避免覆盖而停止:$versionedMsi"
|
throw "旧 MSI 的版本化文件已存在,为避免覆盖而停止:$versionedMsi"
|
||||||
}
|
}
|
||||||
|
|
||||||
Move-Item -LiteralPath $legacyMsi -Destination $versionedMsi
|
$moved = $false
|
||||||
|
for ($attempt = 1; $attempt -le 5; $attempt++) {
|
||||||
|
try {
|
||||||
|
Move-Item -LiteralPath $legacyMsi -Destination $versionedMsi -ErrorAction Stop
|
||||||
|
$moved = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
catch [System.IO.IOException] {
|
||||||
|
if ($attempt -eq 5) { throw }
|
||||||
|
Start-Sleep -Milliseconds 500
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (-not $moved) {
|
||||||
|
throw "无法移动旧 MSI:$legacyMsi"
|
||||||
|
}
|
||||||
Write-Host " Archived existing MSI: $versionedMsi" -ForegroundColor DarkGray
|
Write-Host " Archived existing MSI: $versionedMsi" -ForegroundColor DarkGray
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user