Fixed lock file version comparison
This commit is contained in:
parent
9bdf7ca185
commit
8d9e66889e
1 changed files with 24 additions and 4 deletions
|
@ -78,11 +78,23 @@ namespace Microsoft.Extensions.ProjectModel.Graph
|
||||||
|
|
||||||
private string RenderDependency(LibraryRange arg)
|
private string RenderDependency(LibraryRange arg)
|
||||||
{
|
{
|
||||||
return $"{arg.Name} {RenderVersion(arg.VersionRange)}";
|
var name = arg.Name;
|
||||||
|
|
||||||
|
if (arg.Target == LibraryType.ReferenceAssembly)
|
||||||
|
{
|
||||||
|
name = $"fx/{name}";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"{name} {RenderVersion(arg.VersionRange)}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private string RenderVersion(VersionRange range)
|
private string RenderVersion(VersionRange range)
|
||||||
{
|
{
|
||||||
|
if (range == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (range.MinVersion == range.MaxVersion &&
|
if (range.MinVersion == range.MaxVersion &&
|
||||||
(range.Float == null || range.Float.FloatBehavior == NuGetVersionFloatBehavior.None))
|
(range.Float == null || range.Float.FloatBehavior == NuGetVersionFloatBehavior.None))
|
||||||
{
|
{
|
||||||
|
@ -97,10 +109,18 @@ namespace Microsoft.Extensions.ProjectModel.Graph
|
||||||
sb.Append(range.MinVersion);
|
sb.Append(range.MinVersion);
|
||||||
break;
|
break;
|
||||||
case NuGetVersionFloatBehavior.Prerelease:
|
case NuGetVersionFloatBehavior.Prerelease:
|
||||||
// 1.0.*
|
|
||||||
// Work around nuget bug: https://github.com/NuGet/Home/issues/1598
|
// Work around nuget bug: https://github.com/NuGet/Home/issues/1598
|
||||||
// sb.AppendFormat("{0}-*", range.MinVersion);
|
// sb.AppendFormat("{0}-*", range.MinVersion);
|
||||||
sb.Append($"{range.MinVersion.Version.Major}.{range.MinVersion.Version.Minor}.{range.MinVersion.Version.Build}-*");
|
sb.Append($"{range.MinVersion.Version.Major}.{range.MinVersion.Version.Minor}.{range.MinVersion.Version.Build}");
|
||||||
|
if (string.IsNullOrEmpty(range.MinVersion.Release) ||
|
||||||
|
string.Equals("-", range.MinVersion.Release))
|
||||||
|
{
|
||||||
|
sb.Append($"-*");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sb.Append($"-{range.MinVersion.Release}*");
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case NuGetVersionFloatBehavior.Revision:
|
case NuGetVersionFloatBehavior.Revision:
|
||||||
sb.Append($"{range.MinVersion.Version.Major}.{range.MinVersion.Version.Minor}.{range.MinVersion.Version.Build}.*");
|
sb.Append($"{range.MinVersion.Version.Major}.{range.MinVersion.Version.Minor}.{range.MinVersion.Version.Build}.*");
|
||||||
|
|
Loading…
Reference in a new issue