question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to find MSBuild on hosted runners

See original GitHub issue

The MSBuild dependency step keeps failing.

This is from my GitHub-actions YML file: The host is a Windows_Server-2019 VM on AWS VS flavour installed is Visual Studio 2019 Community Edition with License: Visual Studio Community

- name: Dependency - MSBuild
  uses: microsoft/setup-msbuild@v1.0.1
  with:
    vswhere-path: 'C:\Program Files (x86)\Microsoft Visual Studio\Installer'  

resulting in the error in the step:

Run microsoft/setup-msbuild@v1.0.1 “C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe” -products * -requires Microsoft.Component.MSBuild -property installationPath -latest ##[error]Unable to find MSBuild.

I did add MSBuild location in the system path variable as well.

What am I missing? Thanks for the consideration

I had asked this originally as a comment on #7

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
heathscommented, Dec 7, 2022

You’re using a different action: warrenbuckley/Setup-MSBuild@v1. You’d need to either replace that with microsoft/setup-msbuild@v1 or file an issue on https://github.com/warrenbuckley/Setup-MSBuild. I may be biased since I was the VS setup architect and wrote vswhere, but I’d recommend this one which @timheuer does a great job of keeping up to date.

1reaction
timheuercommented, May 23, 2021

@caibinwav123456 If you are using GitHub’s agents, you don’t need to specify the version flag…as there is only one version of Visual Studio on windows-latest so you’ll get that one. And if you are using the hosted agents, no you don’t have direct access to the machine. If you haven’t used MSBuild locally you may want to familiarize yourself with the commands as you’ll still need to specify them. You can test locally by running msbuild <path-to-your-solution-or-project> and add whatever options you need (configuration, etc.). You can see an example here (although this adds web publishing) https://github.com/timheuer/SimpleFrameworkApp/blob/master/.github/workflows/build.yml#L34

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to find msbuild. · Issue #7 · microsoft/setup- ...
I am trying to run this action on a self-hosted runner. - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.0.0 with: vs-version: 15.0.
Read more >
Azure Pipelines: Msbuild & Vstest cannot find msbuild 15 and ...
Hi,. I am building a pipeline in azure to build a solution in one of our On Prem VM's. The msbuild task cannot...
Read more >
Path to MSBuild
To see what gets used if you type msbuild at the command line, do this: where msbuild . If that's not reporting the...
Read more >
VSBuild@1 - Visual Studio build v1 task
Use this task to build with MSBuild and set the Visual Studio version property. Learn more about installing Visual Studio images on Azure....
Read more >
Building Tooling With GitHub Actions | by James
We need to build our application using MSBuild, on a Windows host. We can use the “windows-latest” tag to specify that this job...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found