Addressing code review comments by comparing the versions differently and by changing the name of SDK to .NET Core SDK.

This commit is contained in:
Livar Cunha 2017-05-24 17:55:18 -07:00
parent 75eac0c92b
commit 1a117568fe
2 changed files with 8 additions and 8 deletions

View file

@ -57,7 +57,7 @@ namespace Microsoft.DotNet.MSBuildSdkResolver
return factory.IndicateFailure(
new[]
{
$"Version {netcoreSdkVersion} of the SDK is smaller than the minimum version"
$"Version {netcoreSdkVersion} of the .NET Core SDK is smaller than the minimum version"
+ $" {sdkReference.MinimumVersion} requested. Check that a recent enough .NET Core SDK is"
+ " installed, increase the minimum version specified in the project, or increase"
+ " the version specified in global.json."
@ -67,14 +67,14 @@ namespace Microsoft.DotNet.MSBuildSdkResolver
var minimumMSBuildVersionString =
File.ReadAllLines(Path.Combine(netcoreSdkDir, "minimumMSBuildVersion"))[0];
var minimumMSBuildVersion = Version.Parse(minimumMSBuildVersionString);
if (context.MSBuildVersion.CompareTo(minimumMSBuildVersion) == -1)
if (context.MSBuildVersion < minimumMSBuildVersion)
{
return factory.IndicateFailure(
new[]
{
$"Version {netcoreSdkVersion} of the SDK requires at least version {minimumMSBuildVersionString}"
$"Version {netcoreSdkVersion} of the .NET Core SDK requires at least version {minimumMSBuildVersionString}"
+ $" of msbuild. The current available version of msbuild is {context.MSBuildVersion.ToString()}."
+ " Change the SDK specified in global.json to an older version that requires the msbuild"
+ " Change the .NET Core SDK specified in global.json to an older version that requires the msbuild"
+ " version currently available."
});
}
@ -110,7 +110,7 @@ namespace Microsoft.DotNet.MSBuildSdkResolver
return true;
}
return FXVersion.Compare(netCoreSdkFXVersion, minimumFXVersion) == -1;
return FXVersion.Compare(netCoreSdkFXVersion, minimumFXVersion) < 0;
}
private string ResolveNetcoreSdkDirectory(SdkResolverContext context)

View file

@ -73,7 +73,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
result.Path.Should().BeNull();
result.Version.Should().BeNull();
result.Warnings.Should().BeNullOrEmpty();
result.Errors.Should().Contain("Version 99.99.99 of the SDK is smaller than the minimum version 999.99.99"
result.Errors.Should().Contain("Version 99.99.99 of the .NET Core SDK is smaller than the minimum version 999.99.99"
+ " requested. Check that a recent enough .NET Core SDK is installed, increase the minimum version"
+ " specified in the project, or increase the version specified in global.json.");
}
@ -99,8 +99,8 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
result.Path.Should().BeNull();
result.Version.Should().BeNull();
result.Warnings.Should().BeNullOrEmpty();
result.Errors.Should().Contain("Version 99.99.99 of the SDK requires at least version 2.0 of msbuild."
+ " The current available version of msbuild is 1.0. Change the SDK specified in global.json to an older"
result.Errors.Should().Contain("Version 99.99.99 of the .NET Core SDK requires at least version 2.0 of msbuild."
+ " The current available version of msbuild is 1.0. Change the .NET Core SDK specified in global.json to an older"
+ " version that requires the msbuild version currently available.");
}