Ruben 1 yıl önce
ebeveyn
işleme
8db4736d97
2 değiştirilmiş dosya ile 23 ekleme ve 17 silme
  1. 2 2
      .github/workflows/TestSignWindows.yaml
  2. 21 15
      Build/Build WPF.ps1

+ 2 - 2
.github/workflows/TestSignWindows.yaml

@@ -21,7 +21,7 @@ jobs:
       # Step 4 (x64): Publish x64 version
       - name: Publish x64 version
         run: |
-          pwsh -File "${{ github.workspace }}\Build\Build WPF.ps1" -Platform "x64" -selfContained 1 -outputPath "${{ github.workspace }}\Build\PicView-v${{steps.get-version.outputs.version}}-win-x64"
+          pwsh -File "${{ github.workspace }}\Build\Build WPF.ps1" -Platform "x64" -selfContained $true -outputPath "${{ github.workspace }}\Build\PicView-v${{steps.get-version.outputs.version}}-win-x64"
         shell: pwsh
 
       # Step 5 (x64): Compile .ISS to .EXE Installer for x64
@@ -34,7 +34,7 @@ jobs:
       # Step 6 (arm64): Publish arm64 version
       - name: Publish arm64 version
         run: |
-          pwsh -File "${{ github.workspace }}\Build\Build WPF.ps1" -Platform "arm64" -selfContained 1 -outputPath "${{ github.workspace }}\Build\PicView-v${{steps.get-version.outputs.version}}-win-arm64"
+          pwsh -File "${{ github.workspace }}\Build\Build WPF.ps1" -Platform "arm64" -selfContained $true -outputPath "${{ github.workspace }}\Build\PicView-v${{steps.get-version.outputs.version}}-win-arm64"
         shell: pwsh
 
 

+ 21 - 15
Build/Build WPF.ps1

@@ -1,12 +1,12 @@
-param (
-    [Parameter()]
-    [string]$platform = "x64",
-
-    [Parameter()]
-    [string]$outputPath = $PSScriptRoot,
-
-    [Parameter()]
-    [bool]$selfContained = $True
+param (
+    [Parameter(Mandatory=$True)]
+    [string]$platform,
+    
+    [Parameter(Mandatory=$True)]
+    [string]$outputPath,
+
+    [Parameter(Mandatory=$True)]
+    [string]$selfContained
 )
 
 # Define the core project path relative to the script's location
@@ -37,11 +37,17 @@ $coreCsproj.Save($coreProjectPath)
 # Define the project path for the actual build target
 $projectPath = Join-Path -Path $PSScriptRoot -ChildPath "..\src\PicView.WPF\PicView.WPF.csproj"
 
-# Run dotnet publish for the project
-dotnet publish $projectPath --runtime "win-$platform" --self-contained $selfContained --configuration Release --output $outputPath /p:PublishReadyToRun=true
-
-
-#Remove uninstended space
-Rename-Item -path $outputPath -NewName $outputPath.Replace(" ","")
+# Ensure the output path exists
+if (-not (Test-Path $outputPath)) {
+    New-Item -Path $outputPath -ItemType Directory
+}
 
+# Run dotnet publish for the project
+dotnet publish $projectPath --runtime win-$platform --self-contained $selfContained --configuration Release --output $outputPath /p:PublishReadyToRun=true
 
+#Remove unintended space
+if (-not [string]::IsNullOrEmpty($outputPath)) {
+    Rename-Item -path $outputPath -NewName $outputPath.Replace(" ","")
+} else {
+    Write-Host "Output path is null or empty."
+}