Skip to content

Commit

Permalink
Don't use Mono MSBuild if it does not exist and display a helpful mes…
Browse files Browse the repository at this point in the history
…sage for Linux users

Fixes OmniSharp#1011
  • Loading branch information
DustinCampbell committed Nov 9, 2017
1 parent 3cdf3e5 commit 2d30ed3
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -82,6 +82,22 @@ public override ImmutableArray<MSBuildInstance> GetInstances()
return NoInstances;
}

// Look for Microsoft.Build.dll in the tools path. If it isn't there, this is likely a Mono layout on Linux
// where the 'msbuild' package has not been installed.
var microsoftBuildPath = Path.Combine(toolsPath, "Microsoft.Build.dll");
if (!File.Exists(microsoftBuildPath))
{
Logger.LogDebug($"Mono MSBuild could not be used because '{microsoftBuildPath}' does not exist.");

if (Platform.Current.OperatingSystem == Utilities.OperatingSystem.Linux)
{
Logger.LogWarning(@"It looks like you have Mono 5.2.0 or greater installed but MSBuild could not be found.
Try installing MSBuild into Mono (e.g. 'sudo apt-get install msbuild') to enable better MSBuild support.");
}

return NoInstances;
}

var propertyOverrides = ImmutableDictionary.CreateBuilder<string, string>(StringComparer.OrdinalIgnoreCase);

var localMSBuildPath = FindLocalMSBuildDirectory();

0 comments on commit 2d30ed3

Please # to comment.