diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0df1e528ecf..54147edb1f3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -186,6 +186,12 @@ jobs: - job: BuildWindowsMSI displayName: Build Windows MSI + strategy: + matrix: + x86: + Platform: x86 + x64: + Platform: x64 dependsOn: ExtractMetadata condition: succeeded() @@ -200,6 +206,7 @@ jobs: - script: | + set ARCH=$(Platform) set /p CLI_VERSION=<$(System.ArtifactsDirectory)/metadata/version set @@ -215,10 +222,16 @@ jobs: displayName: 'Publish Artifact: MSI' inputs: TargetPath: 'build_scripts/windows/out/' - ArtifactName: msi + ArtifactName: msi-$(Platform) - job: TestWindowsMSI displayName: Test Windows MSI + strategy: + matrix: + x86: + Platform: x86 + x64: + Platform: x64 dependsOn: BuildWindowsMSI condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule')) @@ -235,7 +248,7 @@ jobs: displayName: 'Download Build Artifacts' inputs: TargetPath: '$(Build.ArtifactStagingDirectory)/msi' - artifactName: msi + artifactName: msi-$(Platform) - task: PowerShell@2 displayName: Install and Load CLI diff --git a/build_scripts/windows/Product.wxs b/build_scripts/windows/Product.wxs index b8b7d8d6a8b..2db951f4a06 100644 --- a/build_scripts/windows/Product.wxs +++ b/build_scripts/windows/Product.wxs @@ -7,19 +7,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + UpgradeCode="$(var.UpgradeCode)"> - + + + + + + + + + + + + + + + NOT (WIX_DOWNGRADE_DETECTED OR WIX_X86_DOWNGRADE_DETECTED) + + NOT WIX_DOWNGRADE_DETECTED + @@ -61,7 +103,7 @@ - + @@ -78,17 +120,17 @@ + Guid="$(var.RemoveCLIFolderGuid)"> + Guid="$(var.RemoveAzureCLIFolderGuid)"> + Guid="$(var.AzureCliSystemPathGuid)"> + Guid="$(var.AzureCliRegistryGuid)"> + Guid="$(var.AzureCliVersionGuid)"> - - - artifacts\wix\ - $(LocalWixRoot) - $(WixToolPath)Wix.targets - wixtasks.dll - artifacts\cli - -fv - Debug @@ -21,6 +12,15 @@ $(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets $(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets + + + artifacts\wix + $(MSBuildThisFileDirectory)$(LocalWixRoot) + $(WixToolPath)\Wix.targets + $(WixToolPath)\wixtasks.dll + artifacts\cli + -fv + out\$(Configuration)\ out\obj\$(Configuration)\ @@ -31,6 +31,16 @@ out\obj\$(Configuration)\ AzureCliSource=$(AzureCliSource) + + out\$(Configuration)\ + out\obj\$(Configuration)\ + Debug;AzureCliSource=$(AzureCliSource) + + + out\ + out\obj\$(Configuration)\ + AzureCliSource=$(AzureCliSource) + azure-cli.wxs @@ -55,4 +65,4 @@ - \ No newline at end of file + diff --git a/build_scripts/windows/scripts/build.cmd b/build_scripts/windows/scripts/build.cmd index 3944e96b925..94414ed694b 100644 --- a/build_scripts/windows/scripts/build.cmd +++ b/build_scripts/windows/scripts/build.cmd @@ -13,10 +13,22 @@ if "%CLI_VERSION%"=="" ( echo Please set the CLI_VERSION environment variable, e.g. 2.0.13 goto ERROR ) + +if "%ARCH%"=="" ( + set ARCH=x86 +) +if "%ARCH%"=="x86" ( + set PYTHON_ARCH=win32 +) else if "%ARCH%"=="x64" ( + set PYTHON_ARCH=amd64 +) else ( + echo Please set ARCH to "x86" or "x64" + goto ERROR +) set PYTHON_VERSION=3.10.10 set WIX_DOWNLOAD_URL="https://azurecliprod.blob.core.windows.net/msi/wix310-binaries-mirror.zip" -set PYTHON_DOWNLOAD_URL="https://www.python.org/ftp/python/%PYTHON_VERSION%/python-%PYTHON_VERSION%-embed-win32.zip" +set PYTHON_DOWNLOAD_URL="https://www.python.org/ftp/python/%PYTHON_VERSION%/python-%PYTHON_VERSION%-embed-%PYTHON_ARCH%.zip" REM https://pip.pypa.io/en/stable/installation/#get-pip-py set GET_PIP_DOWNLOAD_URL="https://bootstrap.pypa.io/get-pip.py" @@ -34,7 +46,10 @@ set BUILDING_DIR=%ARTIFACTS_DIR%\cli set WIX_DIR=%ARTIFACTS_DIR%\wix set PYTHON_DIR=%ARTIFACTS_DIR%\Python -set REPO_ROOT=%~dp0..\..\.. +REM Get the absolute directory since we pushd into different levels of subdirectories. +PUSHD %~dp0..\..\.. +SET REPO_ROOT=%CD% +POPD REM reset working folders if exist %BUILDING_DIR% rmdir /s /q %BUILDING_DIR% @@ -181,7 +196,7 @@ popd if %errorlevel% neq 0 goto ERROR echo Building MSI... -msbuild /t:rebuild /p:Configuration=Release %REPO_ROOT%\build_scripts\windows\azure-cli.wixproj +msbuild /t:rebuild /p:Configuration=Release /p:Platform=%ARCH% %REPO_ROOT%\build_scripts\windows\azure-cli.wixproj if %errorlevel% neq 0 goto ERROR