public static PackageReferenceXElement New(XElement parent, string name, string versionString) { var packageReference = PackageReferenceXElement.New(name, versionString); parent.Add(packageReference.Value); return(packageReference); }
/// <summary> /// Note, no need for package version string since you can't have mulitple versions of the same package. /// </summary> public static bool HasPackageReference(this PackageReferencesItemGroupXElement packageReferencesItemGroupXElement, string name, out IPackageReference packageReference) { packageReference = packageReferencesItemGroupXElement.GetPackageReferenceXElementsWhereName(name) .Select(xElement => PackageReferenceXElement.From(xElement)) .SingleOrDefault(); var hasPackageReference = PackageReferenceHelper.WasFound(packageReference); return(hasPackageReference); }
public static PackageReferenceXElement New(string name, string versionString) { var xPackageReference = new XElement(ProjectFileXmlElementName.PackageReference); xPackageReference.AddAttribute(ProjectFileXmlElementName.Include, name); xPackageReference.AddAttribute(ProjectFileXmlElementName.Version, versionString); var packageReferenceXElement = PackageReferenceXElement.From(xPackageReference); return(packageReferenceXElement); }
public static IPackageReference AddPackageReference(this PackageReferencesItemGroupXElement packageReferencesItemGroupXElement, string name, string versionString) { var projectReference = PackageReferenceXElement.New(packageReferencesItemGroupXElement, name, versionString); return(projectReference); }
public static PackageReferenceXElement New(PackageReferencesItemGroupXElement parent, string name, string versionString) { var packageReference = PackageReferenceXElement.New(parent.Value, name, versionString); return(packageReference); }
public static PackageReferenceXElement From(XElement value) { var packageReferenceXElement = new PackageReferenceXElement(value); return(packageReferenceXElement); }