From 9110b389998666dc0c6a8e9abd9400248bad8dba Mon Sep 17 00:00:00 2001 From: Aleksandr Chebotov <47745270+al-cheb@users.noreply.github.com> Date: Wed, 19 Aug 2020 10:32:35 +0300 Subject: [PATCH] [Windows 2019] Fix missing msvcr100.dll (#1427) * install vcredist2010 * Microsoft Visual C++ docs section --- images/win/scripts/Installers/Initialize-VM.ps1 | 5 +++++ .../SoftwareReport/SoftwareReport.Generator.ps1 | 5 +++++ .../SoftwareReport/SoftwareReport.Tools.psm1 | 17 +++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/images/win/scripts/Installers/Initialize-VM.ps1 b/images/win/scripts/Installers/Initialize-VM.ps1 index 550eb8a34..bd4619caa 100644 --- a/images/win/scripts/Installers/Initialize-VM.ps1 +++ b/images/win/scripts/Installers/Initialize-VM.ps1 @@ -119,6 +119,11 @@ if (Test-IsWin16) { Choco-Install -PackageName vcredist140 } +if (Test-IsWin19) { + # Install vcredist2010 + Choco-Install -PackageName vcredist2010 +} + # Expand disk size of OS drive New-Item -Path d:\ -Name cmds.txt -ItemType File -Force Add-Content -Path d:\cmds.txt "SELECT VOLUME=C`r`nEXTEND" diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 index 2e69132e5..7ac161c5f 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Generator.ps1 @@ -173,6 +173,11 @@ $markdown += New-MDNewLine $markdown += ((Get-VisualStudioComponents) + (Get-VisualStudioExtensions)) | New-MDTable $markdown += New-MDNewLine +$markdown += New-MDHeader "Microsoft Visual C++:" -Level 4 +$markdown += New-MDNewLine +$markdown += Get-VisualCPPComponents | New-MDTable +$markdown += New-MDNewLine + $markdown += New-MDHeader ".NET Core SDK" -Level 3 $sdk = Get-DotnetSdks $markdown += "``Location $($sdk.Path)``" diff --git a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 index fb1beddcc..6ce6b5b1e 100644 --- a/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 +++ b/images/win/scripts/SoftwareReport/SoftwareReport.Tools.psm1 @@ -223,4 +223,21 @@ function Get-NewmanVersion { function Get-GHVersion { return "GitHub CLI $(gh --version)" +} + +function Get-VisualCPPComponents { + $vcpp = Get-CimInstance -ClassName Win32_Product -Filter "Name LIKE 'Microsoft Visual C++%'" + $vcpp | Sort-Object Name, Version | ForEach-Object { + $isMatch = $_.Name -match "^(?Microsoft Visual C\+\+ \d{4})\s+(?\w{3})\s+(?.+)\s+-" + if ($isMatch) { + $name = '{0} {1}' -f $matches["Name"], $matches["Ext"] + $arch = $matches["Arch"].ToLower() + $version = $_.Version + [PSCustomObject]@{ + Name = $name + Architecture = $arch + Version = $version + } + } + } } \ No newline at end of file