Installing the Visual Studio 2015 toolkit v140 on a Microsoft hosted Azure Devops Build Pipeline Agent

0 votes
I attempted to install the v140 toolset using the 2017 installer:
pool:
    vmImage: 'vs2017-win2016'

steps:
- task: PowerShell@2
  displayName: 'Install Visual Studio v140 Toolset'
  inputs:
    targetType: 'inline'
    script: |
      Write-Output "Starting the installation process. This will take some time"
      $installProcess = Start-Process -FilePath $(Build.SourcesDirectory)/External/VisualStudioBuildTools/installer.exe -ArgumentList "--add Microsoft.VisualStudio.Component.VC.140", "--quiet", "--wait", "--norestart" -Wait -PassThru
      Write-Output "Install Completed with code $($process.ExitCode)"

- task: VSBuild@1
  displayName: 'Build Debug [.sln]'
  inputs:
    solution: '$(Build.SourcesDirectory)/LegacySolution.sln'
    vsVersion: '15.0'
    configuration: 'Debug'
    platform: 'x64'

When I run this in Azure DevOps, the install process exits with code 0 (success) after about a minute. However, when it then tries to build the solution it fails with:
##[error]C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Platform.targets(67,5): Error MSB8020: The build tools for v140 (Platform Toolset = 'v140') cannot be found. To build using the v140 build tools, please install v140 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".

Has anyone tried this before and succeeded?
Mar 29, 2022 in Other DevOps Questions by Kichu
• 19,050 points
849 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Other DevOps Questions

0 votes
2 answers

Which is better azure devops or aws devops?

Azure DevOps, a part of Microsoft's cloud ...READ MORE

answered Jan 8 in Cloud Computing by anonymous
• 700 points
2,019 views
0 votes
1 answer
0 votes
1 answer

What is the Difference between VSO, VSTS and Azure Devops

Azure DevOps was previously known as VSO ...READ MORE

answered Mar 8, 2022 in Azure by Edureka
• 13,620 points

edited Jun 27, 2023 by Khan Sarfaraz 1,349 views
0 votes
1 answer

How can I preview PowerPoint files in Azure DevOps (VSTS)?

For work item attachments, there are no ...READ MORE

answered Mar 8, 2022 in DevOps & Agile by gaurav
• 23,260 points
950 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP