-
Notifications
You must be signed in to change notification settings - Fork 90
Add support for Mono #82
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
Conversation
- on OSX, we get the version from the path - we return the version of currently running mono, as the first result - on linux/windows, we try to get the version from `mono --version` - if that fails, then we return the instance with `0.0.0.0`
|
/cc @akoeplinger |
src/MSBuildLocator/MSBuildLocator.cs
Outdated
| yield break; | ||
| } | ||
|
|
||
| foreach(var dirPath in Directory.EnumerateDirectories(s_monoOSXBasePath)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really needs this? mono --version=number should work fine on OSX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to using mono --version=number. On OSX, doing this for all the versions found.
src/MSBuildLocator/MSBuildLocator.cs
Outdated
| if (_isRunningOnMono == null) | ||
| { | ||
| // There could be potentially expensive TypeResolve events, so cache IsMono. | ||
| // Also, VS does not host Mono runtimes, so turn IsMono off when msbuild is running under VS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you're just talking about VS on Windows right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep
|
@rainersigwald ping |
|
@rainersigwald while I have your attention, ping ;) |
Co-authored-by: Joey Robichaud <joseph.robichaud@microsoft.com>
Co-authored-by: Joey Robichaud <joseph.robichaud@microsoft.com>
Forgind
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind moving the changes to find mono into a separate class/file?
|
Also, per #115 (comment), would you mind pulling in that PR and adding the check? |
- move mono specific stuff to `MSBuildLocator.Mono.cs`
.. trailing slash, addressing feedback in microsoft#82 (comment)
Forgind
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also remember #82 (comment), but I think this is good!
|
|
||
| // The path has a valid mono, but we can't find the version | ||
| // so, let's return the instance at least but with version 0.0.0 | ||
| ver = new Version(0, 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure whether this is better or it's better to not return it. Users could find it separately and register it anyway. @rainersigwald, thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok to merge? Or are we waiting for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to wait for @rainersigwald's signoff. Also, would you mind adding the if-not-mono check discussed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added, and fixed a bug introduced in the nuget PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably ok, let's just listen for feedback.
Co-authored-by: Forgind <Forgind@users.noreply.github.com>
Adds an overload to permit supplying additional paths in which to search for MSBuild assemblies beyond the default. Uses this new overload to add the search path for NuGet assemblies for when in a VS install. The latter fixes microsoft#86.
- it was inverted
rainersigwald
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM. Thanks for your patience on this!
|
|
||
| // The path has a valid mono, but we can't find the version | ||
| // so, let's return the instance at least but with version 0.0.0 | ||
| ver = new Version(0, 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably ok, let's just listen for feedback.
- use RuntimeInformation.IsOSPlatform to detect OSX
|
Does |
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this is unfortunate. I told you to do this! But . . . it's really nice that the Locator package has no dependencies so you can use it basically anywhere. Unfortunately, this type wasn't added to .NET Framework until 4.7.1, so this reference is required to call it in a straightforward way, which makes the package slightly less easy to use.
I think we can call it via reflection instead to avoid that hard requirement--if the type/method is not available, it's not macOS!
result
mono --version=numbermono --version=number0.0.0.0