private static NewPackageReference ConvertOldToNewPackageReference(OldReference oldReference) { var version = GetVersionString(oldReference); var include = oldReference.Include.Split(',').First(); return(version == null || include == "System.Management.Automation" ? null : new NewPackageReference { Include = include, Version = version }); }
public static string GetVersionString(OldReference oldReference) { const string versionToken = " Version="; var hasVersion = oldReference.Include.Contains(versionToken); var hasHintPath = oldReference.HintPath != null; var version = hasHintPath ? CreateVersionFromHintPath(oldReference.HintPath) : null; return(version ?? (hasVersion ? oldReference.Include.Split(',')[1].Replace(versionToken, String.Empty) : null)); }