
The following metadata tags control dependency assets: Tag In this scenario, you can use the PrivateAssets metadata to control this behavior. You might be using a dependency purely as a development harness and might not want to expose that to projects that will consume your package. Floating Versionsįloating versions are supported with PackageReference: As such, in PackageReference projects all sources need to be available for all restores. In PackageReference projects, the transitive dependency versions are resolved at restore time. This will enable packages that those projects refer to, to be "transitively" referenced by your project. This may be useful, if you reference projects which are PackageReference styled (existing csproj or SDK-style projects). Using PackageReference for a project with no package dependenciesĪdvanced: If you have no packages installed in a project (no PackageReferences in project file and no nfig file), but want the project to be restored as PackageReference style, you can set a Project property RestoreProjectStyle to PackageReference in your project file. In the example above, 3.6.0 means any version that is >=3.6.0 with preference for the lowest version, as described on Package versioning. The convention for specifying the version of a package is the same as when using nfig: Adding a PackageReferenceĪdd a dependency in your project file using the following syntax: C++ and JavaScript project types are unsupported. NET Framework include only limited support for PackageReference. To use PackageReference, migrate the dependencies from nfig into your project file, then remove nfig.ĪSP.NET apps targeting the full. NET Standard projects, and UWP projects targeting Windows 10 Build 15063 (Creators Update) and later, with the exception of C++ UWP projects.NET Framework projects support PackageReference, but currently default to nfig.

(See For more details NuGet pack and restore as MSBuild targets.) Project type supportīy default, PackageReference is used for. It also allows for fine-grained control over dependencies and content flow. With PackageReference, you can also use MSBuild conditions to choose package references per target framework, or other groupings.

Use of PackageReference doesn't affect other aspects of NuGet for example, settings in NuGet.Config files (including package sources) are still applied as explained in Common NuGet configurations. Package references, using MSBuild items, specify NuGet package dependencies directly within project files, as opposed to having a separate nfig file.
