Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions assets/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,27 @@

<!--We need to show EULA, and provide option to customize download location-->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />

<!-- Prerequisites check for Windows Universal C time and Visual Studio 2015 C++ redistributables -->
<Property Id="UCRTINSTALLED" Secure="yes">
<DirectorySearch Id="Windows_System32" Path="[WindowsFolder]System32" Depth="0">
<FileSearch Name="ucrtbase.dll"/>

<!-- Prerequisite check for Windows Universal C runtime -->
<Property Id="UNIVERSAL_C_RUNTIME_INSTALLED" Secure="yes">
<DirectorySearch Id="WindowsDirectory" Path="[WindowsFolder]">
<DirectorySearch Id="System32" Path="System32">
<FileSearch Id="ucrtbase" Name="ucrtbase.dll"/>
</DirectorySearch>
</DirectorySearch>
</Property>
<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">
<![CDATA[Installed OR UCRTINSTALLED]]>
<Condition Message="$(env.ProductName) requires the Universal C Runtime to be installed. You can find a download link to it here: https://github.com/PowerShell/PowerShell/blob/master/docs/installation/windows.md#prerequisites">
<![CDATA[Installed OR UNIVERSAL_C_RUNTIME_INSTALLED]]>
</Condition>

<!-- Prerequisite check for Visual Studio 2015 C++ redistributables -->
<Property Id="VISUAL_CPP_RUNTIME_INSTALLED" Secure="yes">
<DirectorySearchRef Id="System32" Parent="WindowsDirectory" Path="System32">
<FileSearch Id="vcruntime140" Name="vcruntime140.dll"/>
</DirectorySearchRef>
</Property>
<Condition Message="$(env.ProductName) requires the Visual Studio 2015 C++ redistributables to be installed. You can find a download link to it here: https://github.com/PowerShell/PowerShell/blob/master/docs/installation/windows.md#prerequisites">
<![CDATA[Installed OR VISUAL_CPP_RUNTIME_INSTALLED]]>
</Condition>

<Directory Id="TARGETDIR" Name="SourceDir">
Expand Down
27 changes: 9 additions & 18 deletions test/powershell/Installer/WindowsInstaller.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,15 @@ Describe "Windows Installer" -Tags "Scenario" {
$global:PSDefaultParameterValues = $originalDefaultParameterValues
}

Context "Universal C Runtime Download Link" {
$universalCRuntimeDownloadLink = 'https://www.microsoft.com/download/details.aspx?id=50410'
It "Wix file should have download link about Universal C runtime" -Pending {
(Get-Content $wixProductFile -Raw).Contains($universalCRuntimeDownloadLink) | Should Be $true
}
It "Should have download link about Universal C runtime that is reachable" {
(Invoke-WebRequest $universalCRuntimeDownloadLink.Replace("https://",'http://')) | Should Not Be $null
}
$preRequisitesLink = 'https://github.com/PowerShell/PowerShell/blob/master/docs/installation/windows.md#prerequisites'

It "WiX (Windows Installer XML) file contains pre-requisites link $preRequisitesLink" {
(Get-Content $wixProductFile -Raw).Contains($preRequisitesLink) | Should Be $true
}

Context "Visual Studio C++ Redistributables Link" {
$visualStudioCPlusPlusRedistributablesDownloadLink = 'https://www.microsoft.com/download/details.aspx?id=48145'
It "WiX file should have documentation about Visual Studio C++ redistributables" -Pending {
(Get-Content $wixProductFile -Raw).Contains($visualStudioCPlusPlusRedistributablesDownloadLink) | Should Be $true
}
It "Should have download link about Universal C runtime that is reachable" {
(Invoke-WebRequest $visualStudioCPlusPlusRedistributablesDownloadLink.Replace("https://",'http://')) | Should Not Be $null
}
It "Pre-Requisistes link $preRequisitesLink is reachable" -TestCases $downloadLinks -Test {
# Because an outdated link 'https://www.microsoft.com/download/details.aspx?id=504100000' would still return a 200 reponse (due to a redirection to an error page), it only checks that it returns something
(Invoke-WebRequest $preRequisitesLink -UseBasicParsing) | Should Not Be $null
}

}
}