@@ -42,6 +42,45 @@ function LogError {
42
42
43
43
try {
44
44
if ($ci ) {
45
+ $vswherePath = " ${env: ProgramFiles(x86)} /Microsoft Visual Studio/Installer/vswhere.exe"
46
+ if (-not (Test-Path $vswherePath )) {
47
+ $vswherePath = " $PSScriptRoot /../modules/KoreBuild.Tasks/vswhere.exe"
48
+ }
49
+
50
+ if (-not (Test-Path $vswherePath )) {
51
+ # Couldn't use vswhere, return 'msbuild.exe' and let PATH do its thing.
52
+ Write-Host -f Red " Could not find VSWhere. Relying on MSBuild to exist on PATH"
53
+ }
54
+ else {
55
+ [string []] $vswhereArgs = @ (' -latest' , ' -format' , ' json' , ' -products' , ' *' , ' -prerelease' , ' -version' , ' [16.0, 17.0)' )
56
+ Write-Host -f Magenta " > $vswherePath $vsWhereArgs "
57
+ & $vswherePath @vswhereArgs | Write-Host
58
+
59
+ $vswhereArgs += ' -property' , ' displayName' , ' -format' , ' text' , ' -nologo'
60
+ foreach ($requirement in
61
+ " Microsoft.Net.Component.4.6.1.TargetingPack" ,
62
+ " Microsoft.Net.Component.4.6.2.TargetingPack" ,
63
+ " Microsoft.Net.Component.4.7.1.TargetingPack" ,
64
+ " Microsoft.Net.Component.4.7.2.SDK" ,
65
+ " Microsoft.Net.Component.4.7.2.TargetingPack" ,
66
+ " Microsoft.Net.Component.4.7.TargetingPack" ,
67
+ " Microsoft.VisualStudio.Component.Azure.Storage.Emulator" ,
68
+ " Microsoft.VisualStudio.Component.VC.ATL" ,
69
+ " Microsoft.VisualStudio.Component.VC.Tools.x86.x64" ,
70
+ " Microsoft.VisualStudio.Component.VC.v141.ATL" ,
71
+ " Microsoft.VisualStudio.Component.VC.v141.x86.x64" ,
72
+ " Microsoft.VisualStudio.Component.Windows10SDK.17134" ,
73
+ " Microsoft.VisualStudio.Workload.ManagedDesktop" ,
74
+ " Microsoft.VisualStudio.Workload.NativeDesktop" ,
75
+ " Microsoft.VisualStudio.Workload.NetCoreTools" ,
76
+ " Microsoft.VisualStudio.Workload.NetWeb" ,
77
+ " Microsoft.VisualStudio.Workload.VisualStudioExtension" ) {
78
+ $vsWhereArgs_Requires = $vsWhereArgs + ' -requires' , $requirement
79
+ Write-Host -f Magenta " > $vswherePath $vsWhereArgs_Requires "
80
+ & $vswherePath @vsWhereArgs_Requires | Write-Host
81
+ }
82
+ }
83
+
45
84
# Install dotnet.exe
46
85
& $repoRoot / build.ps1 - ci - norestore / t:InstallDotNet
47
86
}
0 commit comments