Class PackageReference
Represents a package element in the packages.config file
public class PackageReference
- Inheritance
-
PackageReference
- Inherited Members
Constructors
PackageReference(PackageIdentity, NuGetFramework)
Creates a new packages config entry
public PackageReference(PackageIdentity identity, NuGetFramework targetFramework)
Parameters
identityPackageIdentitytargetFrameworkNuGetFramework
PackageReference(PackageIdentity, NuGetFramework, bool)
Creates a new packages config entry
public PackageReference(PackageIdentity identity, NuGetFramework targetFramework, bool userInstalled)
Parameters
identityPackageIdentitytargetFrameworkNuGetFrameworkuserInstalledbool
PackageReference(PackageIdentity, NuGetFramework, bool, bool, bool)
Creates a new packages config entry
public PackageReference(PackageIdentity identity, NuGetFramework targetFramework, bool userInstalled, bool developmentDependency, bool requireReinstallation)
Parameters
identityPackageIdentitytargetFrameworkNuGetFrameworkuserInstalledbooldevelopmentDependencyboolrequireReinstallationbool
PackageReference(PackageIdentity, NuGetFramework, bool, bool, bool, VersionRange)
Creates a new packages config entry
public PackageReference(PackageIdentity identity, NuGetFramework targetFramework, bool userInstalled, bool developmentDependency, bool requireReinstallation, VersionRange allowedVersions)
Parameters
identityPackageIdentityPackage id and version
targetFrameworkNuGetFrameworkPackage target framework installed to the project
userInstalledboolTrue if the user installed this package directly
developmentDependencyboolTrue if the package is a development dependency
requireReinstallationboolTrue if this package needs to be reinstalled
allowedVersionsVersionRangeRestrict package versions to the allowedVersions range
Properties
AllowedVersions
The allowed range of versions that this package can be upgraded/downgraded to.
public VersionRange AllowedVersions { get; }
Property Value
- VersionRange
Remarks
This is null if unbounded
HasAllowedVersions
True if allowedVersions exists.
public bool HasAllowedVersions { get; }
Property Value
IsDevelopmentDependency
Development dependency
public bool IsDevelopmentDependency { get; }
Property Value
IsUserInstalled
True if the user installed or updated this package directly. False if this package was installed as a dependency by another package.
public bool IsUserInstalled { get; }
Property Value
PackageIdentity
Id and Version of the package
public PackageIdentity PackageIdentity { get; }
Property Value
RequireReinstallation
Require reinstallation
public bool RequireReinstallation { get; }
Property Value
TargetFramework
Installed target framework version of the package.
public NuGetFramework TargetFramework { get; }
Property Value
- NuGetFramework
Methods
ToString()
Displays the identity and target framework of the reference.
public override string ToString()