8000 Make MSI installer perform pre-requisite checks (#4602) · PowerShell/PowerShell@54e892a · GitHub
[go: up one dir, main page]

Skip to content

Commit 54e892a

Browse files
bergmeisterTravisEz13
authored andcommitted
Make MSI installer perform pre-requisite checks (#4602)
* #4458 MSI installer checks that the Windows C Runtime and VS Studio 2015 C++ redistributables are present and returns error message if not. Includes tests to check that the Wix file contains the download URLs and those URLs are not dead.
1 parent f6208f3 commit 54e892a

File tree

3 files changed

+53
-3
lines changed

3 files changed

+53
-3
lines changed

assets/Product.wxs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,30 @@
6060

6161
<!--We need to show EULA, and provide option to customize download location-->
6262
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
63+
64+
<!-- Prerequisites check for Windows Universal C time and Visual Studio 2015 C++ redistributables -->
65+
<Property Id="UCRTINSTALLED" Secure="yes">
66+
<DirectorySearch Id="Windows_System32" Path="[WindowsFolder]System32" Depth="0">
67+
<FileSearch Name="ucrtbase.dll"/>
68+
</DirectorySearch>
69+
</Property>
70+
<Property Id="VCREDISTINSTALLEDX64" Secure="yes">
71+
<RegistrySearch Id="VCRedist_RegSearch_x64" Root="HKLM" Name="Version" Type="raw" Win64="yes"
72+
Key="SOFTWARE\Microsoft\DevDiv\VC\Servicing\14.0\RuntimeMinimum"/>
73+
</Property>
74+
<Property Id="VCREDISTINSTALLEDX86" Secure="yes">
75+
<RegistrySearch Id="VCRedist_RegSearch_x86" Root="HKLM" Name="Version" Type="raw" Win64="no"
76+
Key="SOFTWARE\Microsoft\DevDiv\VC\Servicing\14.0\RuntimeMinimum"/>
77+
</Property>
78+
<Condition Message="$(env.ProductName) requires the Universal C Runtime to be installed. You can download it here: https://www.microsoft.com/download/details.aspx?id=50410">
79+
<![CDATA[Installed OR UCRTINSTALLED]]>
80+
</Condition>
81+
<Condition Message="$(env.ProductName) requires the Visual Studio C++ 2015 x64 redistributables to be installed. You can download it here: https://www.microsoft.com/download/details.aspx?id=48145">
82+
<![CDATA[Installed OR ("$(var.ProductTargetArchitecture)" = "x64" AND VCREDISTINSTALLEDX64 AND VCREDISTINSTALLEDX64 >= "14.0.23918")]]>
83+
</Condition>
84+
<Condition Message="$(env.ProductName) requires the Visual Studio C++ 2015 x86 redistributables to be installed. You can download it here: https://www.microsoft.com/download/details.aspx?id=48145">
85+
<![CDATA[Installed OR (VCREDISTINSTALLEDX86 AND VCREDISTINSTALLEDX86 >= "14.0.23918")]]>
86+
</Condition>
6387

6488
<Directory Id="TARGETDIR" Name="SourceDir">
6589
<Directory Id="$(var.ProductProgFilesDir)">

docs/installation/windows.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ There is a shortcut placed in the Start Menu upon installation.
1414

1515
### Prerequisites
1616

17-
* Install the [Universal C Runtime](https://www.microsoft.com/en-us/download/details.aspx?id=50410) on Windows versions prior to Windows 10.
17+
* Install the [Universal C Runtime](https://www.microsoft.com/download/details.aspx?id=50410) on Windows versions prior to Windows 10.
1818
It is available via direct download or Windows Update.
1919
Fully patched (including optional packages), supported systems will already have this installed.
20-
* Install the [Visual C++ Redistributable](https://my.visualstudio.com/Downloads?pid=2082) for VS2015.
20+
* Install the [Visual C++ Redistributable](https://www.microsoft.com/download/details.aspx?id=48145) for VS2015.
2121

2222
## Deploying on Nano Server
2323

24-
These instructions assume that Windows PowerShell is running on the Nano Server image and that it has been generated by the [Nano Server Image Builder](https://technet.microsoft.com/en-us/windows-server-docs/get-started/deploy-nano-server).
24+
These instructions assume that Windows PowerShell is running on the Nano Server image and that it has been generated by the [Nano Server Image Builder](https://technet.microsoft.com/windows-server-docs/get-started/deploy-nano-server).
2525
Nano Server is a "headless" OS and deployment of PowerShell Core binaries can happen in two different ways:
2626

2727
1. Offline - Mount the Nano Server VHD and unzip the contents of the zip file to your chosen location within the mounted image.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
$thisTestFolder = Split-Path $MyInvocation.MyCommand.Path -Parent
2+
$wixProductFile = Join-Path $thisTestFolder "..\..\..\assets\Product.wxs"
3+
4+
Describe "Windows Installer" -Tags "Scenario" {
5+
6+
Context "Universal C Runtime Download Link" {
7+
$universalCRuntimeDownloadLink = 'https://www.microsoft.com/download/details.aspx?id=50410'
8+
It "Wix file should have download link about Universal C runtime" {
9+
(Get-Content $wixProductFile -Raw).Contains($universalCRuntimeDownloadLink) | Should Be $true
10+
}
11+
It "Should have download link about Universal C runtime that is reachable" {
12+
(Invoke-WebRequest $universalCRuntimeDownloadLink.Replace("https://",'http://')) | Should Not Be $null
13+
}
14+
}
15+
16+
Context "Visual Studio C++ Redistributables Link" {
17+
$visualStudioCPlusPlusRedistributablesDownloadLink = 'https://www.microsoft.com/download/details.aspx?id=48145'
18+
It "WiX file should have documentation about Visual Studio C++ redistributables" {
19+
(Get-Content $wixProductFile -Raw).Contains($visualStudioCPlusPlusRedistributablesDownloadLink) | Should Be $true
20+
}
21+
It "Should have download link about Universal C runtime that is reachable" {
22+
(Invoke-WebRequest $visualStudioCPlusPlusRedistributablesDownloadLink.Replace("https://",'http://')) | Should Not Be $null
23+
}
24+
}
25+
26+
}

0 commit comments

Comments
 (0)
0