Skip to content

Commit

Permalink
Merge pull request #72 from nventive/dev/jela/global-json
Browse files Browse the repository at this point in the history
fix: Handle unreadable global.json sdk version
  • Loading branch information
jeromelaban authored Apr 17, 2024
2 parents e4fb36c + 6c28ef7 commit b086cbe
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 b086cbe

Please sign in to comment.