Rediger

Del via


NuGet Warning NU5127

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, if that package contains build files specific to one or more Target Framework Monikers (TFMs), a package consumer may expect the package to fail if none of the build files are used.

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.