Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specification of vs-version fails on windows-2022 runners #132

Open
robbmcleod opened this issue Jul 3, 2024 · 3 comments
Open

Specification of vs-version fails on windows-2022 runners #132

robbmcleod opened this issue Jul 3, 2024 · 3 comments
Assignees
Labels
📃 documentation Improvements or additions to documentation

Comments

@robbmcleod
Copy link

robbmcleod commented Jul 3, 2024

The documentation suggests that one can select an older version of MSBuild by specifying it in the YAML:

- name: Add msbuild to PATH
  uses: microsoft/setup-msbuild@v2
  with:
    vs-version: '[16.4,16.5)'

However, this does not work on GitHub Actions. vswhere returns no result.

Run microsoft/setup-msbuild@v2
C:\ProgramData\Chocolatey\bin\vswhere.exe -products * -requires Microsoft.Component.MSBuild -property installationPath -latest -version [17.7,17.8)
Error: Unable to find MSBuild.

If we look at the Windows latest config, it seems the problem is likely that no older versions of MSBuild are installed:

https://github.com/actions/runner-images/blob/main/images/windows/toolsets/toolset-2022.json

Is this intended to work only on self-hosted runners? If so the documentation should be more clear.

@timheuer
Copy link
Member

timheuer commented Jul 3, 2024

Correct, the version you are looking for must exist, or you will hit a failure as indicated. It is not an acquisition argument, it is a path argument really. See: https://github.com/microsoft/setup-msbuild#specifying-specific-versions-of-visual-studio-optional and https://github.com/microsoft/setup-msbuild#notes-on-arguments noting Using these require you to fully understand the runner environment, updates to the tools on the runner, and can cause failures if you are out of sync.

Any suggestions to make that clearer we are happy to update a remark on the README.

@timheuer timheuer self-assigned this Jul 3, 2024
@timheuer timheuer added the 📃 documentation Improvements or additions to documentation label Jul 3, 2024
@FabienDanieau
Copy link

This configuration was working fine until I've got the same error yesterday.

    - name: Setup MSBuild
      uses: microsoft/setup-msbuild@v2
      with:
        vs-version: '[17.10,17.11)'

Do I have to specific an exact version as listed here https://github.com/dotnet/msbuild/releases ?
I tried [17.11.4, 17.12) but it also failed

@timheuer
Copy link
Member

@FabienDanieau see what is available on the hosted agent: https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md

For hosted you don’t really have an option and will really only have one version so specifying the version isn’t recommended really as noted here: https://github.com/microsoft/setup-msbuild?tab=readme-ov-file#notes-on-arguments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📃 documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants