Skip to content

Bug: passing path to installed VsTest.console.exe produces error. #27

@brian-welsh

Description

@brian-welsh

As a workaround to the newer version of VsTest not being used by this action, I resorted to attempting to use the vstestLocation input argument.

VSWHERE correctly returns a path of:

C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe. 

Because the long path names include spaces, passing this value through vstestLocation input argument produces error:

Error: Unable to locate executable file: C:\Program. 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.

Release Version: 1.0.0

How to reproduce:

  1. In your workflow add a powershell step containing:
- id: setup
  run: |
    $vswhere=vswhere -latest -products * -requires Microsoft.VisualStudio.Workload.ManagedDesktop     Microsoft.VisualStudio.Workload.Web -requiresAny -property installationPath
    $vswhere=join-path $vswhere 'Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe'
    if (test-path $vswhere) {
      write-output "vstest-path=$vswhere" >> $env:GITHUB_OUTPUT
    } else {
      write-output "::warning::Unable to locate VSTest.console.exe"
    }
  shell: pwsh
  1. use vstest-action passing vstestLocation argument
      - name: Run vstests
        uses: microsoft/vstest-action@v1.0.0
        with:
          searchFolder: '${{github.workspace}}/out'
          vstestLocationMethod: location
          vstestLocation: '${{ steps.setup.outputs.vstest-path }}'
          testAssembly: |
              **/*test*.dll
              !./**/*TestAdapter.dll
              !./**/obj/**
  1. run workflow and observe error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions