Skip to content

Commit

Permalink
fix: Handle unreadable global.json sdk version
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Apr 17, 2024
1 parent cddbb6b commit b136152
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/NvGet/Helpers/SolutionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ private static async Task<PackageReference[]> GetGlobalJsonFileReferences(Cancel

var references = globalJson
?.MSBuildSdks
?.Select(s => new PackageIdentity(s.Key, new NuGetVersion(s.Value)))
?.Select(s => NuGetVersion.TryParse(s.Value, out var version) ? new PackageIdentity(s.Key, version) : null)
?.Where(v => v is not null)
.ToArray() ?? Array.Empty<PackageIdentity>();

return references
Expand Down

0 comments on commit b136152

Please sign in to comment.