From 908235e3ee91f11e5eade668602f065327e43cc3 Mon Sep 17 00:00:00 2001 From: Mikhail Timofeev Date: Fri, 6 Mar 2020 17:04:48 +0300 Subject: [PATCH] Add Analysis extension installation --- images/win/Windows2019-Azure.json | 12 +++++ .../Install-AnalysisExtenstion.ps1 | 44 +++++++++++++++++++ .../Validate-AnalysisExtenstion.ps1 | 18 ++++++++ 3 files changed, 74 insertions(+) create mode 100644 images/win/scripts/Installers/Windows2019/Install-AnalysisExtenstion.ps1 create mode 100644 images/win/scripts/Installers/Windows2019/Validate-AnalysisExtenstion.ps1 diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index c1dc9252d..7b0352263 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -172,6 +172,12 @@ "{{ template_dir }}/scripts/Installers/Windows2019/Install-Wix.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Windows2019/Install-AnalysisExtenstion.ps1" + ] + }, { "type": "powershell", "valid_exit_codes": [ @@ -204,6 +210,12 @@ "{{ template_dir }}/scripts/Installers/Windows2019/Validate-Wix.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Windows2019/Validate-AnalysisExtenstion.ps1" + ] + }, { "type": "powershell", "scripts":[ diff --git a/images/win/scripts/Installers/Windows2019/Install-AnalysisExtenstion.ps1 b/images/win/scripts/Installers/Windows2019/Install-AnalysisExtenstion.ps1 new file mode 100644 index 000000000..43bfb6030 --- /dev/null +++ b/images/win/scripts/Installers/Windows2019/Install-AnalysisExtenstion.ps1 @@ -0,0 +1,44 @@ +################################################################################### +## File: Install-AnalysisExtenstion.ps1 +## Desc: Install the Microsoft Analysis Services Projects Visual Studio extension +################################################################################### + + +$extensionUrl = "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/ProBITools/vsextensions/MicrosoftAnalysisServicesModelingProjects/2.9.5/vspackage" +$extensionDownloadPath = Join-Path $Env:TEMP "Microsoft.DataTools.AnalysisServices.vsix" +Write-Host "Downloading Microsoft.DataTools.AnalysisServices.vsix extension" +(New-Object System.Net.WebClient).DownloadFile($extensionUrl, $extensionDownloadPath) + +Write-Host "Installing Microsoft.DataTools.AnalysisServices.vsix extension" +try +{ + $process = Start-Process ` + -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\VSIXInstaller.exe" ` + -ArgumentList ("/quiet", "$extensionDownloadPath") ` + -Wait ` + -PassThru +} +catch +{ + Write-Host "There is an error during Microsoft.DataTools.AnalysisServices.vsix installation" + $_ + exit 1 +} + + +$exitCode = $process.ExitCode + +if ($exitCode -eq 0 -or $exitCode -eq 1001) # 1001 means the extension is already installed +{ + Write-Host "Microsoft.DataTools.AnalysisServices.vsix installed successfully" +} +else +{ + Write-Host "Unsuccessful exit code returned by the installation process: $exitCode." + exit 1 +} + +#Cleanup installation files +Remove-Item -Force -Confirm:$false $extensionDownloadPath + +exit $exitCode diff --git a/images/win/scripts/Installers/Windows2019/Validate-AnalysisExtenstion.ps1 b/images/win/scripts/Installers/Windows2019/Validate-AnalysisExtenstion.ps1 new file mode 100644 index 000000000..fad85d512 --- /dev/null +++ b/images/win/scripts/Installers/Windows2019/Validate-AnalysisExtenstion.ps1 @@ -0,0 +1,18 @@ +################################################################################ +## File: Validate-AnalysisExtenstion.ps1 +## Desc: Validate Microsoft Analysis Services Projects Visual Studio extension +################################################################################ + +Import-Module -Name ImageHelpers -Force + +#AnalysisPackage doesn't have any proper name in the state.packages.json file, only id is available +$AnalysisPackageVersion = Get-VS19ExtensionVersion -packageName "04a86fc2-dbd5-4222-848e-911638e487fe" + +# Adding description of the software to Markdown +$SoftwareName = "Microsoft Analysis Services Projects Visual Studio Extension" + +$Description = @" +_Version:_ $AnalysisPackageVersion
+"@ + +Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description \ No newline at end of file