diff --git a/src/OmniSharp.Host/MSBuild/Discovery/Providers/StandAloneInstanceProvider.cs b/src/OmniSharp.Host/MSBuild/Discovery/Providers/StandAloneInstanceProvider.cs index f0cb645681..e7cf7be033 100644 --- a/src/OmniSharp.Host/MSBuild/Discovery/Providers/StandAloneInstanceProvider.cs +++ b/src/OmniSharp.Host/MSBuild/Discovery/Providers/StandAloneInstanceProvider.cs @@ -30,19 +30,29 @@ public override ImmutableArray GetInstances() var propertyOverrides = ImmutableDictionary.CreateBuilder(StringComparer.OrdinalIgnoreCase); - // To better support older versions of Mono that don't include - // MSBuild 15, we attempt to set property overrides to the locations - // of Mono's 'xbuild' and 'xbuild-frameworks' paths. - if (_allowMonoPaths && PlatformHelper.IsMono) + if (PlatformHelper.IsMono) { - if (TryGetMonoXBuildPath(out var xbuildPath)) + // This disables a hack in the "GetReferenceAssemblyPaths" task which attempts + // guarantee that .NET Framework SP1 is installed when the target framework is + // .NET Framework, but the version is less than 4.0. The hack attempts to locate + // a particular assembly in the GAC as a "guarantee". However, we don't include that + // in our Mono package. So, we'll just bypass the check. + propertyOverrides.Add("BypassFrameworkInstallChecks", "true"); + + // To better support older versions of Mono that don't include + // MSBuild 15, we attempt to set property overrides to the locations + // of Mono's 'xbuild' and 'xbuild-frameworks' paths. + if (_allowMonoPaths) { - extensionsPath = xbuildPath; - } - - if (TryGetMonoXBuildFrameworksPath(out var xbuildFrameworksPath)) - { - propertyOverrides.Add("TargetFrameworkRootPath", xbuildFrameworksPath); + if (TryGetMonoXBuildPath(out var xbuildPath)) + { + extensionsPath = xbuildPath; + } + + if (TryGetMonoXBuildFrameworksPath(out var xbuildFrameworksPath)) + { + propertyOverrides.Add("TargetFrameworkRootPath", xbuildFrameworksPath); + } } } diff --git a/src/OmniSharp.MSBuild/ProjectFile/PropertyNames.cs b/src/OmniSharp.MSBuild/ProjectFile/PropertyNames.cs index 572036a5fd..2de1455018 100644 --- a/src/OmniSharp.MSBuild/ProjectFile/PropertyNames.cs +++ b/src/OmniSharp.MSBuild/ProjectFile/PropertyNames.cs @@ -7,6 +7,7 @@ internal static class PropertyNames public const string AssemblyOriginatorKeyFile = nameof(AssemblyOriginatorKeyFile); public const string BuildProjectReferences = nameof(BuildProjectReferences); public const string BuildingInsideVisualStudio = nameof(BuildingInsideVisualStudio); + public const string BypassFrameworkInstallChecks = nameof(BypassFrameworkInstallChecks); public const string Configuration = nameof(Configuration); public const string CscToolExe = nameof(CscToolExe); public const string CscToolPath = nameof(CscToolPath); diff --git a/src/OmniSharp.MSBuild/ProjectLoader.cs b/src/OmniSharp.MSBuild/ProjectLoader.cs index c494f9a5a3..dd16de599c 100644 --- a/src/OmniSharp.MSBuild/ProjectLoader.cs +++ b/src/OmniSharp.MSBuild/ProjectLoader.cs @@ -52,6 +52,11 @@ private static Dictionary CreateGlobalProperties( globalProperties.AddPropertyOverride(PropertyNames.Configuration, options.Configuration, propertyOverrides, logger); globalProperties.AddPropertyOverride(PropertyNames.Platform, options.Platform, propertyOverrides, logger); + if (propertyOverrides.TryGetValue(PropertyNames.BypassFrameworkInstallChecks, out var value)) + { + globalProperties.Add(PropertyNames.BypassFrameworkInstallChecks, value); + } + return globalProperties; }