From 5a78f134281188cf8c3e261bf1c65b8d50565342 Mon Sep 17 00:00:00 2001 From: Javi Pulido Date: Wed, 18 May 2022 18:27:27 +0200 Subject: [PATCH] Fix version path on XML --- GenerateInstaller.ps1 | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/GenerateInstaller.ps1 b/GenerateInstaller.ps1 index e6034aa..2a9cba8 100644 --- a/GenerateInstaller.ps1 +++ b/GenerateInstaller.ps1 @@ -15,7 +15,7 @@ param [string]$buildOutputPath = "WinRemoteControl\bin\Release\net6.0-windows\win-x86\publish", [string]$CsprojPath = "WinRemoteControl\WinRemoteControl.csproj", [string]$SetupIconFile = "WinRemoteControl\Resources\big_icon_5jt_icon.ico", - [Parameter(HelpMessage="Overrides build identifier, script tries to get it automatically")][Version]$buildIdentifier, + [Parameter(HelpMessage="Overrides build identifier, script tries to get it automatically")]$buildIdentifier, [string]$baseDirectory = "$PSScriptRoot", [string]$installerOutputPath = "Installer\Output", [string]$setupExecutableName = "WinRemoteControl_Setup_32" @@ -48,12 +48,6 @@ $installerFolderPath = Join-Path (Get-Location).Path "Installer" $innoSetupScriptPath = Resolve-Path (Join-Path $installerFolderPath "InstallerScript.iss") $innoSetupResourcesPath = Resolve-Path (Join-Path $installerFolderPath "InnoSetupResources") -# Normalize installer output path -#if(![System.IO.Path]::IsPathRooted($installerOutputPath)) -#{ -# $installerOutputPath = Join-Path (Get-Location).Path $installerOutputPath -#} - if($pathsAreRelativeToBaseDirectory) { $buildOutputPath = Join-Path $baseDirectory $buildOutputPath @@ -88,8 +82,12 @@ if (-Not (Test-Path $innoSetupCompilerPath)) } # Get version from csproj -$xml = [Xml] (Get-Content $CsprojPath) -$buildIdentifier = [Version] $xml.Project.PropertyGroup.Version +if($null -eq $buildIdentifier ) +{ + LogDebug "Build identifier not set, try to obtain it from .csproj" + $xml = [Xml] (Get-Content $CsprojPath) + $buildIdentifier = [version] $xml.Project.PropertyGroup[1].Version +} LogSection "END Pre-compilation tasks"