diff --git a/src/NvGet/Helpers/SolutionHelper.cs b/src/NvGet/Helpers/SolutionHelper.cs index a3d3244..5c826b8 100644 --- a/src/NvGet/Helpers/SolutionHelper.cs +++ b/src/NvGet/Helpers/SolutionHelper.cs @@ -222,7 +222,8 @@ private static async Task 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(); return references