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

MSBuildLocator.RegisterDefaults() throws on Mono #72

Closed ionoy closed 5 years ago

ionoy commented 5 years ago

Hello guys!

I'm using Microsoft.Build.Locator 1.2.2 NuGet package in my net472 console application. This application is executed on macOS using mono. The goal is to analyze a solution (.sln) with MSBuildWorkspace.

MSBuildLocator.RegisterDefaults() fails with PlatformNotSupportedException because there is a call from VisualStudioLocationHelper.GetQuery() to Marshal.GetTypeFromCLSID which is not supported on Mono (https://github.com/mono/mono/blob/master/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs#L838)

Am I misunderstanding something or it is impossible to use Microsoft.Build.Locator on Mono?

P.S. .NET Core doesn't work for me, because Core MSBuildWorkspace fails to load non-Core solutions.

rainersigwald commented 5 years ago

You're correct. MSBuildLocator does not currently support Mono: #41.

I'm not aware of a great way to deal with this situation at the moment. I expect things to get better in the future with the advent of .NET 5.