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/ファイルのないパッケージはすべてのプロジェクトと互換であるとみなされます。 ただし、そのパッケージに 1 つ以上 のターゲット フレームワークモニカー(TFM) に固有のビルド ファイルが含まれている場合、パッケージ コンシューマーは、ビルド ファイルが使用されていない場合にパッケージが失敗することを予期することがあります。

解決策

警告メッセージが示すように、リストされている TFM の lib フォルダーに名前が_._のEmpty空のファイルを作成します。 これにより、プロジェクトがパッケージと互換性がない場合、NuGet はプロジェクトの復元 PackageReference に失敗します。