Skip to content
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

Raised the minimum picked up VS version to 16.3 #1713

Merged
merged 3 commits into from
Feb 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All changes to the project will be documented in this file.
## [1.34.12] - not yet released
* Fixed out of bounds exception in line mapping ([omnisharp-vscode#3485](https://github.com/OmniSharp/omnisharp-vscode/issues/3485), PR: [#1707](https://github.com/OmniSharp/omnisharp-roslyn/pull/1707))
* Added support for aliases in project references ([#1685](https://github.com/OmniSharp/omnisharp-roslyn/issues/1685), PR: [#1701](https://github.com/OmniSharp/omnisharp-roslyn/pull/1701))
* Raised the lowest discovered VS2019 version to 16.3 ((#1700)[https://github.com/OmniSharp/omnisharp-roslyn/issues/1700], PR: (#1713)(https://github.com/OmniSharp/omnisharp-roslyn/pull/1713))

## [1.34.11] - 2020-02-05
* Updated the bundled to Mono 6.8.0 and MSBuild to be copied from Mono 6.8.0 ([#1693](https://github.com/OmniSharp/omnisharp-roslyn/issues/1693), PR: [#1697](https://github.com/OmniSharp/omnisharp-roslyn/pull/1697))
Expand Down
2 changes: 1 addition & 1 deletion src/OmniSharp.Host/MSBuild/Discovery/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private static int GetInstanceFeatureScore(MSBuildInstance i)
score--;

// VS 2019 should be preferred
if (i.Version.Major >= 16)
if (i.Version.Major >= 16 && i.Version.Minor >= 3)
score++;
else
score--;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public override ImmutableArray<MSBuildInstance> GetInstances()
new MSBuildInstance(
nameof(DiscoveryType.Mono),
toolsPath,
new Version(16, 3),
new Version(16, 4),
DiscoveryType.Mono,
propertyOverrides.ToImmutable()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public override ImmutableArray<MSBuildInstance> GetInstances()
new MSBuildInstance(
nameof(DiscoveryType.StandAlone),
toolsPath,
new Version(16, 3), // we now ship with embedded MsBuild 16.3
new Version(16, 4), // we now ship with embedded MsBuild 16.4
DiscoveryType.StandAlone,
propertyOverrides.ToImmutable(),
setMSBuildExePathVariable: true));
Expand Down
27 changes: 15 additions & 12 deletions tests/OmniSharp.MSBuild.Tests/MSBuildSelectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public void RegisterDefaultInstanceFindsTheBestInstanceAvailable()
new MSBuildInstance(
"Test Instance",
TestIO.GetRandomTempFolderPath(),
Version.Parse("16.1.2.3"),
Version.Parse("16.3.2.3"),
DiscoveryType.VisualStudioSetup
).AddDotNetCoreToFakeInstance(),
GetStandAloneMSBuildInstance()
Expand All @@ -50,7 +50,7 @@ public void RegisterDefaultInstanceFindsTheBestInstanceAvailableEvenWithOtherVal
new MSBuildInstance(
"Valid Test Instance",
TestIO.GetRandomTempFolderPath(),
Version.Parse("16.3.2.1"),
Version.Parse("16.3.2.3"),
DiscoveryType.VisualStudioSetup
),
GetInvalidMsBuildInstance(),
Expand All @@ -59,7 +59,7 @@ public void RegisterDefaultInstanceFindsTheBestInstanceAvailableEvenWithOtherVal
new MSBuildInstance(
"Another Valid Test Instance",
TestIO.GetRandomTempFolderPath(),
Version.Parse("16.1.2.3"),
Version.Parse("16.3.2.1"),
DiscoveryType.VisualStudioSetup
).AddDotNetCoreToFakeInstance(),
GetStandAloneMSBuildInstance()
Expand Down Expand Up @@ -107,7 +107,7 @@ public void RegisterDefaultInstanceFindsUserOverrideAvailableEvenWithOtherValidI
new MSBuildInstance(
"Manually Overridden",
TestIO.GetRandomTempFolderPath(),
Version.Parse("99.0.0"),
Version.Parse("1.0.0"),
DiscoveryType.UserOverride
).AddDotNetCoreToFakeInstance(),
};
Expand Down Expand Up @@ -136,7 +136,7 @@ public void RegisterDefaultInstanceStillPrefersTheFirstInstance()
new MSBuildInstance(
"Test Instance",
TestIO.GetRandomTempFolderPath(),
Version.Parse("16.1.2.3"),
Version.Parse("16.3.2.3"),
DiscoveryType.VisualStudioSetup
),
GetStandAloneMSBuildInstance()
Expand All @@ -155,22 +155,25 @@ public void RegisterDefaultInstanceStillPrefersTheFirstInstance()
msbuildLocator.DeleteFakeInstancesFolders();
}

[Fact]
public void StandAloneIsPreferredOverVS2017()
[Theory]
[InlineData("15.1.2.3")]
[InlineData("16.1.2.3")]
[InlineData("16.2.2.3")]
public void StandAloneIsPreferredOverUnsupportedVS(string vsVersion)
{
var msBuildInstances = new[]
{
new MSBuildInstance(
"Test Instance",
TestIO.GetRandomTempFolderPath(),
Version.Parse("15.1.2.3"),
Version.Parse(vsVersion),
DiscoveryType.VisualStudioSetup
),
).AddDotNetCoreToFakeInstance(),
GetStandAloneMSBuildInstance()
};

var msbuildLocator = new MSFakeLocator(msBuildInstances);
var logger = LoggerFactory.CreateLogger(nameof(StandAloneIsPreferredOverVS2017));
var logger = LoggerFactory.CreateLogger(nameof(StandAloneIsPreferredOverUnsupportedVS));

// test
msbuildLocator.RegisterDefaultInstance(logger);
Expand All @@ -187,9 +190,9 @@ private static MSBuildInstance GetStandAloneMSBuildInstance()
return new MSBuildInstance(
"Stand Alone :(",
TestIO.GetRandomTempFolderPath(),
Version.Parse("16.3.0.0"),
Version.Parse("16.4.0.0"),
DiscoveryType.StandAlone
);
).AddDotNetCoreToFakeInstance();
}

private static MSBuildInstance GetInvalidMsBuildInstance()
Expand Down