Skip to content

Commit

Permalink
Cap assembly version components at 65535. Not a great solution, but i…
Browse files Browse the repository at this point in the history
…t's good enough for now.
  • Loading branch information
wasabii committed Oct 30, 2023
1 parent 8fd3756 commit 03ec8b0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/IKVM.MSBuild.Tasks/IkvmReferenceItemPrepare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ static Version ToAssemblyVersion(ModuleVersion version)
// only include major and minor by default
var major = GetAssemblyVersionComponent(version, 0);
var minor = GetAssemblyVersionComponent(version, 1);
if (minor is not null && major is not null)
return new Version(major ?? 0, minor ?? 0, 0, 0);
if (major is not null)
return new Version((int)major, minor ?? 0, 0, 0);

return null;
}
Expand All @@ -456,7 +456,7 @@ static Version ToAssemblyVersion(ModuleVersion version)
/// <returns></returns>
static int? GetAssemblyVersionComponent(ModuleVersion version, int index)
{
return version.Number.Count > index && version.Number[index] is int i ? i : null;
return version.Number.Count > index && version.Number[index] is int i ? Math.Min(i, ushort.MaxValue) : null;
}

/// <summary>
Expand Down

0 comments on commit 03ec8b0

Please sign in to comment.