Buildalyzer icon indicating copy to clipboard operation
Buildalyzer copied to clipboard

Buildalizer chooses MSBuild without .NET components

Open Inok opened this issue 4 years ago • 4 comments

I have the following Visual Studio installations:

  • Visual Studio 2019 (with .NET components)
  • Visual Studio Build Tools 2019 (with C++ components only)

Buildalizer chooses VS Build Tools 2019 installation to run msbuild. Since it has no .NET components, the build fails. Installing .NET components to that installation fixes the problem. But maybe it's possible to choose the appropriate installation by a Buildalizer itself?

Inok avatar Jan 23 '21 23:01 Inok

What an interesting scenario. It never occurred to me this might be a problem, but it makes total sense. I guess the challenge is knowing which one to pick - I.e. if it were reversed and the VS Build Tools had the .NET components but the VS install only had C++, how would we know?

daveaglick avatar Jan 24 '21 00:01 daveaglick

vswhere allows to search for VS installation with required components: https://github.com/microsoft/vswhere I guess it can be used to find appropriate installation. It's a part of VS Installer, so it's possible to call it from there. Also, it looks like there is an option to distribute vswhere as a part of Buildalizer.

Inok avatar Jan 24 '21 12:01 Inok

@daveaglick @Inok is there a plan to fix this issue ? we are using this project for building another tool and would be happy to contribute and fix if not fixed yet....

birojnayak avatar Oct 27 '21 05:10 birojnayak

How about https://github.com/microsoft/MSBuildLocator

What is Locator for? MSBuild offers a .NET API surface that allows you to evaluate and build MSBuild projects from an application.

Loading MSBuild from Visual Studio also ensures that your application gets the same view of projects as MSBuild.exe, dotnet build, or Visual Studio, including bug fixes, feature additions, and performance improvements that may come from a newer MSBuild release.

smhmhmd avatar Oct 27 '21 06:10 smhmhmd