Skip to content

[BUG]: VsTest versionfinder.ts uses deprecated wmic #21123

@karambawow

Description

@karambawow

New issue checklist

Task name

VsTest

Task version

3.255.0

Issue Description

Issue: versionfinder.ts uses deprecated wmic – please switch to vswhere.exe

Description

The script versionfinder.ts currently uses wmic to detect installed Visual Studio versions. This is problematic because:

  • wmic has been officially deprecated since Windows 10 21H1 and is no longer available on newer systems.
  • Microsoft itself recommends using vswhere.exe for this exact purpose.
  • Using wmic leads to unnecessary failures in modern build environments.

Even GitHub Copilot (or GPT-4-based tools) can refactor the code to use vswhere.exe instead — so this is not a technical challenge, but rather a matter of maintenance and modernization.

Suggestion

Please replace the wmic-based logic with a call to vswhere.exe, for example:

const output = cp.execSync(`"${vswherePath}" -latest -products * -requires Microsoft.Component.MSBuild -property installationPath -format value`);

------------------------------------------------------------------------------------------------------



### Environment type (Please select at least one enviroment where you face this issue)

- [x] Self-Hosted
- [ ] Microsoft Hosted
- [ ] VMSS Pool
- [ ] Container

### Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

### Azure DevOps Server Version (if applicable)

Azure DevOps Server 2022.2 (AzureDevopsServer_20250527.1)

### Operation system

Server 2025

### Relevant log output

```shell
Starting: VsTest - testAssemblies
==============================================================================
Task         : Visual Studio Test
Description  : Run unit and functional tests (Selenium, Appium, Coded UI test, etc.) using the Visual Studio Test (VsTest) runner. Test frameworks that have a Visual Studio test adapter such as MsTest, xUnit, NUnit, Chutzpah (for JavaScript tests using QUnit, Mocha and Jasmine), etc. can be run. Tests can be distributed on multiple agents using this task (version 2 and later).
Version      : 3.255.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/test/vstest
==============================================================================
Running tests using vstest.console.exe runner.
======================================================
Test selector : Test assemblies
Test filter criteria : undefined
Search folder : D:\b\21\2\s
Action when minimum tests threshold not met : donothing
Minimum tests expected to be run: 0
VisualStudio version selected for test execution : latest
Attempting to find vstest.console from a visual studio installation with version [17.0,18.0).
Run in parallel : false
Run in isolation : false
Path to custom adapters : undefined
Other console options : undefined
Code coverage enabled : false
Diagnostics enabled : false
Run the tests locally using vstest.console.exe
========================================================
Test selector : Test assemblies
Test assemblies : [ '**\\bin\\**\\*test.dll', '**\\bin\\**\\*tests.dll' ]
Test filter criteria : undefined
Search folder : D:\b\21\2\s
Run settings file : D:\b\21\2\s
Run in parallel : false
Run in isolation : false
Path to custom adapters : undefined
Other console options : undefined
Code coverage enabled : false
Diagnostics enabled : false
Rerun failed tests: false
VisualStudio version selected for test execution : latest
Attempting to find vstest.console from a visual studio installation with version [17.0,18.0).
##[error]Error: Unable to locate executable file: 'wmic'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.

Full task logs with system.debug enabled

 [REPLACE THIS WITH YOUR INFORMATION] 

Repro steps

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions