private bool CheckPackageReferences(TextWriter textWriter) { var allGood = true; foreach (var packageRef in _projectUtil.GetPackageReferences()) { var allowedPackageVersons = GetAllowedPackageReferenceVersions(packageRef).ToList(); if (!allowedPackageVersons.Contains(packageRef.Version)) { textWriter.WriteLine($"PackageReference {packageRef.Name} has incorrect version {packageRef.Version}"); textWriter.WriteLine($"Allowed values are " + string.Join(" or", allowedPackageVersons)); allGood = false; } } return(allGood); }
private bool CheckPackageReferences(TextWriter textWriter) { var allGood = true; foreach (var packageRef in _projectUtil.GetPackageReferences()) { var name = packageRef.Name.Replace(".", "").Replace("-", ""); var floatingName = $"$({name}Version)"; var fixedName = $"$({name}FixedVersion)"; if (packageRef.Version != floatingName && packageRef.Version != fixedName && !IsAllowedFloatingVersion(packageRef, ProjectFilePath)) { textWriter.WriteLine($"PackageReference {packageRef.Name} has incorrect version {packageRef.Version}"); textWriter.WriteLine($"Allowed values are {floatingName} or {fixedName}"); allGood = false; } } return allGood;