Merged PR 675: Add VS2017 to installprerequisite and remove NET471

This commit is contained in:
Michael Tsai 2018-08-10 03:24:16 +00:00 коммит произвёл Jiajun Wang
Родитель 4e82a7dcdd 67950dcbcd
Коммит 5519847d8b
3 изменённых файлов: 48 добавлений и 76 удалений

Просмотреть файл

@ -27,45 +27,6 @@ if(-not $ConfigPath)
$Category = "PTF"
# Check if the required .NET framework version is installed on current machine
Function CheckIfNet47IsInstalled{
$isInstalled = $false
if(-not (Test-Path "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full"))
{
return $false
}
else
{
try
{
$NetVersion = (Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" -Name Version).Version
if($NetVersion)
{
$majorVersion = [int]$NetVersion.Substring(0,1)
if($majorVersion -gt 4)
{
$isInstalled = $true
}
elseif ($majorVersion -eq 4)
{
$minorVersion = [int]$NetVersion.Substring(2,3)
if ($minorVersion -ge 7)
{
$isInstalled = $true
}
}
}
}
catch
{
$isInstalled = $false
}
}
return $isInstalled;
}
# Check if application is installed on current machine.
Function CheckIfAppInstalled{
Param (
@ -289,49 +250,43 @@ $psVer = [int](Get-Host).Version.ToString().Substring(0,1)
foreach($item in $downloadList)
{
$isInstalled = $false;
if($item.Name.ToLower().Equals("net471"))
$isInstalled = CheckIfAppInstalled -AppName $item.AppName -Version $item.version -Compatible $item.BackwardCompatible
if(-not $isInstalled)
{
$isInstalled = CheckIfNet47IsInstalled
$content = "Application: " +$item.AppName + " is not installed"
}
if(-not $isInstalled)
{
$content = ".NET Framework 4.7.1 is not installed"
}
if ($item.Name.ToLower().Equals("vs2017community"))
{
cmd.exe /C "InstallVs2017Community.cmd"
}
else
{
$isInstalled = CheckIfAppInstalled -AppName $item.AppName -Version $item.version -Compatible $item.BackwardCompatible
if(-not $isInstalled)
if(-not $IsInstalled)
{
$content = "Application: " +$item.AppName + " is not installed"
}
}
Write-Host $content -ForegroundColor Yellow
$content = "Downloading file " + $item.Name + ". Please wait..."
Write-Host $content
$outputPath = $tempFolder + "\" + $item.FileName
if(-not $IsInstalled)
{
Write-Host $content -ForegroundColor Yellow
$content = "Downloading file " + $item.Name + ". Please wait..."
Write-Host $content
$outputPath = $tempFolder + "\" + $item.FileName
try
{
DownloadAndInstallApplication -PSVersion $psVer -AppItem $item -OutputPath $outputPath
}
catch
{
$failedList += $item.Name
$IsInstalled = $false;
$ErrorMessage = $_.Exception.Message
Write-Host $ErrorMessage -ForegroundColor Red
Break;
}
try
{
DownloadAndInstallApplication -PSVersion $psVer -AppItem $item -OutputPath $outputPath
}
catch
{
$failedList += $item.Name
$IsInstalled = $false;
$ErrorMessage = $_.Exception.Message
Write-Host $ErrorMessage -ForegroundColor Red
Break;
}
if($item.NeedRestart)
{
$IsNeedRestart = $true;
if($item.NeedRestart)
{
$IsNeedRestart = $true;
}
}
}
}

Просмотреть файл

@ -0,0 +1,17 @@
:: Copyright (c) Microsoft. All rights reserved.
:: Licensed under the MIT license. See LICENSE file in the project root for full license information.
:: Update vs installer
vs_community.exe --update --quiet --wait
:: Install vs_community with the following
vs_community.exe --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community" ^
--add Microsoft.VisualStudio.Workload.NativeDesktop ^
--add Microsoft.VisualStudio.Workload.ManagedDesktop ^
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ^
--add Microsoft.Net.Component.4.7.1.TargetingPack ^
--add Microsoft.Net.ComponentGroup.4.7.1.DeveloperTools ^
--add Microsoft.VisualStudio.Component.Windows10SDK.16299.Desktop ^
--add Microsoft.VisualStudio.Component.TestTools.Core ^
--add Microsoft.Component.MSBuild ^
--wait --passive --norestart

Просмотреть файл

@ -1,11 +1,11 @@
<Dependency>
<tools>
<tool name="NET471" FileName="NET471.exe" AppName=".NET Framework 4.7.1" version="4.7.2558.0" url="https://download.microsoft.com/download/9/0/1/901B684B-659E-4CBD-BEC8-B3F06967C2E7/NDP471-DevPack-ENU.exe" arguments="/q"/>
<tool name="VS2017Community" FileName="vs_community.exe" AppName="Visual Studio 2017 Community" version="15.7.27703.2042" url="https://aka.ms/vs/15/release/vs_community.exe" arguments="/q /">
<tool name="Wix311" FileName="Wix311.exe" AppName="WiX Toolset v3.11" version="3.11.1" url="https://github.com/wixtoolset/wix3/releases/download/wix3111rtm/wix311.exe" arguments="/q"/>
<tool name="SE" FileName="SpecExplorer.msi" AppName="Spec Explorer 2010" version="3.5.3146.0" url="https://visualstudiogallery.msdn.microsoft.com/271d0904-f178-4ce9-956b-d9bfa4902745/file/36449/3/SpecExplorer.msi" arguments="/q"/>
</tools>
<PTF>
<tool>NET471</tool>
<tool>VS2017Community</tool>
<tool>Wix311</tool>
<tool>SE</tool>
</PTF>