Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This package does not contain a lib/ or ref/ folder, and will therefore be treated as compatible for all frameworks. Since framework specific files were found under the build/ directory for net45, netstandard2.0, consider creating the following empty files to correctly narrow the compatibility of the package:
-lib/net45/.
-lib/netstandard2.0/.
Issue
Projects using packages with PackageReference
only use lib/
and ref/
assemblies to determine package compatibility.
Therefore, a package without any lib/
or ref/
files will be considered compatible with all projects.
However, packages containing MSBuild props or targets that are specific to one or more target frameworks show intent in only being compatible with those target frameworks.
For example, consider a package PackageA
contains a single file, build/net8.0/PackageA.targets
.
If this package is referenced by a project targeting net48
(.NET Framework, Version 4.8), NuGet will not emit any warnings or errors, but also will not select any assets from the package.
Therefore, the package consumer will not be notified that the package does not work correctly with their project.
Solution
As the warning message suggests, create an empty file named _._
in the lib folder for the TFMs listed.
This will allow NuGet to fail the restore for PackageReference
projects when the project is incompatible with the package.
If your package is intended to be compatible with all target frameworks, but only take effect for certain target frameworks, create a file build/{PackageId}.props
whose contents are <Project />
.