[BUG]: Agent does not support preview versions of Microsoft.VisualStudio.Product.BuildTools
Nico-1987 opened this issue · comments
What happened?
We deployed a preview version of the Visual Studio Build Tools (17.10.0-preview2) on our build server.
When setting up a new agent, the expected Visual Studio system capabilities for VS are not set.
(MSBuild_17.0, MSBuild_17.0_x64, VisualStudio, VisualStudio_17.0, VisualStudio_IDE, VisualStudio_IDE_17.0)
We traced it down to the VisualStudioFunctions.ps1 file that does not search for the prerelease versions of the BuildTools, only for the real Visual Studio editions.
Please add logic to the agents to support the preview versions of the Build Tools.
When adding " -prerelease" to the vswhere.exe line in the VisualStudioFunctions.ps1 script, the agent works properly.
Versions
Reproduced in 3.225.3, confirmed in the sources the issue still exists
Environment type (Please select at least one enviroment where you face this issue)
- Self-Hosted
- Microsoft Hosted
- VMSS Pool
- Container
Azure DevOps Server type
Azure DevOps Server (Please specify exact version in the textbox below)
Azure DevOps Server Version (if applicable)
Azure DevOps Server 2022 Update 1
Operation system
Windows 10
Version controll system
Git
Relevant log output
No response
Additionally, is there any documentation on how to set the IncludePrereleaseVersions flag?
Is this supposed to be set as a system variable?
if($env:IncludePrereleaseVersions -eq $true)
{
$preReleaseFlag = "-prerelease"
}
When setting the IncludePrereleaseVersions environment variable to true on my build server and reboot, the script does not pick up. When doing a manual check in PowerShell, it does.
For now i have updated the VisualStudioFunctions.ps1 file on my test agents that need to use the preview version, to always include the -prerelease flag in the vswhere command. The capabilities are now added to the agent.
& $PSScriptRoot\..\..\..\externals\vswhere\vswhere.exe -version "[$MajorVersion.0,$($MajorVersion+1).0)" -products Microsoft.VisualStudio.Product.BuildTools -latest -prerelease -format json 2>&1 |
@Nico-1987, could you set environment variable IncludePrereleaseVersions before execution?
Example:
$env:IncludePrereleaseVersions = $true
# Execute necessary script that uses IncludePrereleaseVersions variable
@Nico-1987, could you set environment variable IncludePrereleaseVersions before execution?
Example:
$env:IncludePrereleaseVersions = $true # Execute necessary script that uses IncludePrereleaseVersions variable
Yes i have tried that.
If you look at the script you can see the Preview flag is only used for the Enterprise lookup, not for the build scripts.
I think you need to add the $preReleaseFlag into line 41, to ensure its actually used
@Nico-1987, I've created a PR with adding -prerelease
flag to lookup vsbuildtools.
The environment variable $env:IncludePrereleaseVersions
is set in PowerShellCapabilitiesProvider.cs by enabling an agent knob EnableVSPreReleaseVersions therefore to lookup for prerelease version, you can set $env:ENABLE_VS_PRERELEASE_VERSIONS
to $true
Looks good, thanks
The agent with this change is now available for use.