microsoft / MSBuildLocator

An API to locate MSBuild assemblies from an installed Visual Studio location. Use this to ensure that calling the MSBuild API will use the same toolset that a build from Visual Studio or msbuild.exe would.
Other
220 stars 83 forks source link

Mono support #41

Closed rainersigwald closed 1 year ago

rainersigwald commented 6 years ago

Mono GACs the old xbuild assemblies but not the new MSBuild 15 ones, so applications running on Mono have the same load-the-right-MSBuild-assembly problems as on full framework, exacerbated since there's no Mono packages so a NuGet reference pulls a Windows-only full-framework assembly.

abock commented 6 years ago

This could be a starting point for "modern" MSBuild support in Mono, representing some work I did this afternoon. It's working nicely on macOS at least.

I started with .NET Core support as well (really want to be able to run via dotnet xunit). Unfortunately I had to give up on that path due to lack of time/more pressing matters because after assemblies are loaded from the .NET Core SDK, the particular code I want to play with (ProjectCollection.LoadProject) crashes with StackOverflowException when loading a simple SDK style project with no [explicit] dependencies. No problems at all on Mono.

I'll continue to look into this over time and would be happy to adapt what I come up with into a PR here.

DustinCampbell commented 6 years ago

We also do this OmniSharp here: https://github.com/OmniSharp/omnisharp-roslyn/blob/master/src/OmniSharp.Host/MSBuild/Discovery/Providers/MonoInstanceProvider.cs.

abock commented 6 years ago

@DustinCampbell Nice. OmniSharp is probably a more ideal starting place. How does it find MSBuild inside .NET Core SDKs? Not seeing anything obvious in the Providers directory.

DustinCampbell commented 6 years ago

It doesn't. OmniSharp ships a small standalone set of MSBuild assemblies as a fallback.

Forgind commented 1 year ago

We're not adding support for mono.