PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, November 21, 2022

[FIXED] Why does vswhere not find VS Build Tools when a specific version is specified?

 November 21, 2022     azure-pipelines, msbuild, visual-studio     No comments   

Issue

In our build task log I see,

"D:\DevopsBuildAgents\Agent 1\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.166.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -latest -format json
"D:\DevopsBuildAgents\Agent 1\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.166.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
"D:\DevopsBuildAgents\Agent 1\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.166.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -latest -format json
"D:\DevopsBuildAgents\Agent 1\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.166.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
##[warning]Visual Studio was not found. Try installing a supported version of Visual Studio. See the task definition for a list of supported versions.
##[warning]Unable to find MSBuild version '14.0' for architecture 'x86'. Falling back to version '4.0'.

This is the output I see if I run this command:

"D:\DevopsBuildAgents\Agent 1\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.166.2\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json    
[]

This is the output I see if I remove the version parameter:

"D:\DevopsBuildAgents\Agent 1\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.166.2\ps_modules\MSBuildHelpers\vswhere.exe" -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
[
  {
    "instanceId": "07f7c44a",
    "installDate": "2022-05-07T03:42:53Z",
    "installationName": "VisualStudio/17.1.6+32421.90",
    "installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools",
    "installationVersion": "17.1.32421.90",
    "displayName": "Visual Studio Build Tools 2022",
    "description": "The Visual Studio Build Tools allows you to build native and managed MSBuild-based applications without requiring the Visual Studio IDE. There are options to install the Visual C++ compilers and libraries, MFC, ATL, and C++/CLI support.",
    "updateDate": "2022-05-07T03:42:53.2726915Z",
    "enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
    "channelId": "VisualStudio.17.Release",
    "channelUri": "https://aka.ms/vs/17/release/channel",
    "installedChannelUri": "https://aka.ms/vs/17/release/channel",
    "releaseNotes": "https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.1#17.1.6",
    "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=661288"
  }
]

This is the output I get if I just run:

"D:\DevopsBuildAgents\Agent 1\_work\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.166.2\ps_modules\MSBuildHelpers\vswhere.exe"
Visual Studio Locator version 1.0.62 [query version 3.1.2200.53929]
Copyright (C) Microsoft Corporation. All rights reserved.

I've tried doing a repair install of Visual Studio 2022 Build Tools.

It would appear version 17.x of Build Tools is present. Why is it returning nothing when the version parameter is added to this command, as seen in the agent log?


Solution

It turns out that the latest version of Azure Devops 2020.1.1 still does not support Visual Studio 2022. So, even though newer devops agents recognize the software, the Devops Server doesn't query for it properly.

If it were working properly it would issue a version parameter that looks like -version [17.0,18.0) or similar.

Uninstalling Visual Studio 2022 build tools and replacing it with Visual Studio 2019 build tools, solved the problem.

Alternatively, there are at least two solutions I found for replacing the built in tasks in Azure Devops 2020 and enabling support for Visual Studio 2022.

https://github.com/jessehouwing/azure-pipelines-tasks-zips/releases/tag/m204

https://www.almhussar.com/blog/how-to-build-and-support-net-6-and-vs-2022-projects-using-azure-devops-server-2020/



Answered By - Appleoddity
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing