瀏覽代碼

Test switching architecture

Ruben 11 月之前
父節點
當前提交
c2c6375eaa
共有 2 個文件被更改,包括 17 次插入11 次删除
  1. 6 7
      .github/workflows/TestSignWindows.yaml
  2. 11 4
      Build/ChangeX64-ARM64.ps1

+ 6 - 7
.github/workflows/TestSignWindows.yaml

@@ -38,14 +38,13 @@ jobs:
         with:
           path: .\Build\install.iss
           options: /O+ /DMyAppVersion=${{steps.get-version.outputs.file-version}} /DMyAppOutputDir=${{ github.workspace }}\Build\install /DMyFileSource=${{ github.workspace }}\Build\PicView-v${{steps.get-version.outputs.version}}-win-x64 /DAppIcon=${{ github.workspace }}\src\PicView.WPF\Themes\Resources\img\icon__Q6k_icon.ico /DLicenseFile=${{ github.workspace }}\src\PicView.Core\Licenses\LICENSE.txt /DMyAppOutputName=Setup-PicView-v${{steps.get-version.outputs.version}}-win-x64
-
-      # Step 6 change to arm64 version
-      - name: Publish arm64 version
-        run: |
-          pwsh -File "${{ github.workspace }}\Build\ChangeX64-ARM64.ps1"
+     
+     # Step 6:  Switch to arm64 architecture
+      - name: Switch to arm64 architecture
+        run: pwsh -File "${{ github.workspace }}\Build\ChangeX64-ARM64.ps1"
         shell: pwsh
 
-    # Step 7 (arm64): Publish x64 version
+     # Step 7 (arm64): Publish x64 version
       - name: Publish arm64 version
         run: |
           $projectPath = ".\src\PicView.WPF\PicView.WPF.csproj"
@@ -54,7 +53,7 @@ jobs:
         shell: pwsh
 
 
-      # Step 8 (arm64): Compile .ISS to .EXE Installer for arm64
+     # Step 8 (arm64): Compile .ISS to .EXE Installer for arm64
       - name: Compile .ISS to .EXE Installer (arm64)
         uses: Minionguyjpro/[email protected]
         with:

+ 11 - 4
Build/ChangeX64-ARM64.ps1

@@ -4,24 +4,31 @@ $coreProjectPath = Join-Path -Path $PSScriptRoot -ChildPath "..\src\PicView.Core
 # Load the .csproj file as XML
 [xml]$coreCsproj = Get-Content $coreProjectPath
 
-# Define the package reference to replace
+# Define the package references for x64 and arm64
 $packageRefX64 = "Magick.NET-Q8-OpenMP-x64"
 $packageRefArm64 = "Magick.NET-Q8-OpenMP-arm64"
 
-# Find the Magick.NET package reference and update it based on the platform
+# Find the current package reference
 $packageNodes = $coreCsproj.Project.ItemGroup.PackageReference | Where-Object { $_.Include -eq $packageRefX64 -or $_.Include -eq $packageRefArm64 }
+
 if ($packageNodes) {
     foreach ($packageNode in $packageNodes) {
         if ($packageNode.Include -eq $packageRefArm64) {
+            # Switch from arm64 to x64
             $packageNode.Include = $packageRefX64
             Write-Output "Switched arm64 -> x64"
         } elseif ($packageNode.Include -eq $packageRefX64) {
+            # Switch from x64 to arm64
             $packageNode.Include = $packageRefArm64
             Write-Output "Switched x64 -> arm64"
-        } else {
-            Write-Output "No matching PackageReference found."
         }
     }
+} else {
+    Write-Output "No Magick.NET package references found. Adding a new one for arm64."
+    # Add a new PackageReference if none exists
+    $newNode = $coreCsproj.CreateElement("PackageReference")
+    $newNode.SetAttribute("Include", $packageRefArm64)
+    $coreCsproj.Project.ItemGroup[0].AppendChild($newNode) | Out-Null
 }
 
 # Save the updated .csproj file