NuGet 警告 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/_._
问题
具有 PackageReference
且使用包的项目仅使用 lib/
和 ref/
程序集来确定包兼容性。 因此,不带任何 lib/
或 ref/
文件的包将被视为与所有项目兼容。 但是,如果此包含有特定于一个或多个目标框架名字对象 (TFM) 的生成文件,则当未使用任何生成文件时,包使用者可能会希望包失败。
解决方案
正如警告消息所建议的那样,为列出的 TFM 创建在 lib 文件夹中创建一个名为 _._
的空文件。 如此一来,当项目与包不兼容时,NuGet 则会为 PackageReference
项目使还原失败。
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈