ターゲット フレームワーク

NuGet は、多様な場所にあるターゲット フレームワーク参照を使用してパッケージのフレームワーク依存コンポーネントを特定し、分離します。

  • プロジェクト ファイル: SDK スタイルのプロジェクトの場合、 .csproj にはターゲット フレームワークリファレンスを包含。
  • .nuspec マニフェスト: パッケージは、プロジェクトのターゲット フレームワークに依存するプロジェクトに含めるパッケージを指定できます。
  • .nupkg フォルダー名: パッケージの lib フォルダー内のフォルダーには、ターゲット フレームワークに従って名前を付けることができます。各フォルダーには、そのフレームワークに適した DLL や他のコンテンツが含まれます。
  • packages.config: 依存関係の targetframework 属性で、インストールするパッケージのバリエーションを指定します。

Note

NuGet では最新のすべての .NET ターゲット フレームワークに対応します。

対応フレームワーク

通常、フレームワークは、短いターゲット フレームワーク モニカー (TFM) で参照されます。 .NET Standard の場合、1 つのリファレンスで複数のフレームワークをリファレンスできるように、TxM に汎用化されています。

Note

以下の表を計算する NuGet クライアントのソース コードは、次の場所にあります。

NuGet クライアントは以下の表のフレームワークをサポートしています。 同等のものがかっこ [] 内に示されています。 dotnet などの一部のツールは、一部のファイルで正規の TFM のバリエーションを使用することがあります。 例えば、dotnet pack.nuspecファイル内で、netcoreapp2.0ではなく.NETCoreApp2.0を使用します。 さまざまな NuGet クライアント ツールがこれらのバリエーションを適切に処理しますが、ファイルを直接編集するときは常に正規の TFM を使用することをお勧めします。

名前 省略形 TFM/TxM
.NET Framework net net11
net20
net35
net40
net403
net45
net451
net452
net46
net461
net462
net47
net471
net472
net48
Microsoft Store (Windows Store) netcore netcore [netcore45]
netcore45 [win、win8]
netcore451 [win81]
netcore50
.NET MicroFramework netmf netmf
Windows 勝利 win [win8, netcore45]
win8 [netcore45, win]
win81 [netcore451]
win10 (Windows 10 プラットフォームでは未対応)
Silverlight sl sl4
sl5
Windows Phone (SL) wp wp [wp7]
wp7
wp75
wp8
wp81
Windows Phone (UWP) wpa81
ユニバーサル Windows プラットフォーム uap uap [uap10.0]
uap10.0
uap10.0.xxxxx (10.0.xxxxx は実行するアプリのターゲットにするプラットフォーム最小バージョンです)
.NET Standard netstandard netstandard1.0
netstandard1.1
netstandard1.2
netstandard1.3
netstandard1.4
netstandard1.5
netstandard1.6
netstandard2.0
netstandard2.1
.NET 5+ (および .NET Core) netcoreapp netcoreapp1.0
netcoreapp1.1
netcoreapp2.0
netcoreapp2.1
netcoreapp2.2
netcoreapp3.0
netcoreapp3.1
net net5.0
net6.0
net7.0
net8.0
Tizen tizen tizen3
tizen4
ネイティブ native native

非推奨のフレームワーク

次のフレームワークは非推奨とされます。 これらのフレームワークを対象とするパッケージは、指定されている代替のフレームワークに移行するようにしてください。

非推奨のフレームワーク 代替
aspnet50 netcoreapp
aspnetcore50
dnxcore50
dnx
dnx45
dnx451
dnx452
dotnet netstandard
dotnet50
dotnet51
dotnet52
dotnet53
dotnet54
dotnet55
dotnet56
winrt 勝利

優先順位

フレームワークの番号は相互の関連性や互換性を示していますが、必ずしも同一ではありません。

フレームワーク 使用可能
uap (ユニバーサル Windows プラットフォーム) win81
wpa81
netcore50
win (Microsoft Store) winrt

NET Standard

.NET Standard はbinary互換性のあるフレームワーク間のリファレンスをシンプルにし、1 つのターゲット フレームワークで複数のフレームワークをまとめることがリファレンスできます。 (背景については、「.NET のガイド」を参照してください。)。

NuGet の Get Nearest Framework Tool では、プロジェクトのフレームワークに基づいて、パッケージ内で使用できる複数のフレームワーク アセットから、1 つのフレームワークを選択するために使用する NuGet をシミュレートしています。

NuGet 3.3 以前には dotnet シリーズのモニカーを使用し、v3.4 以降には netstandard モニカー構文を使用することをお勧めします。

ポータブル クラス ライブラリ

警告

PCL はお勧めできません。 PCL は対応していますが、パッケージ作成者は代わりに netstandard に対応することをお勧めします。 .NET Platform Standard は PCL が進化したもので、portable-a+b+c モニカーのような静的なライブラリに関連付けられていない単一モニカーを使用する、プラットフォームをまたぐbinary移植可能なことを表します。

複数の子ターゲット フレームワークを参照するターゲット フレームワークを定義するには、参照されるフレームワークの一覧に接頭辞として portable キーワードを使用します。 このようなフレームワークでは意図しない副作用を招く可能性があるため、直接コンパイルされない余計なフレームワークは人為的に含めないようにしてださい。

第三者によって定義された追加のフレームワークは、この方法でアクセスできる他の環境との互換性を提供します。 さらに、これらの関連するフレームワークの組み合わせを Profile# として参照するために使用できる省略形のプロファイル番号がありますが、フォルダーと .nuspec の読みやすさが低下するため、このような番号を使用することは勧められません。

プロファイル番号 フレームワーク 姓名 .NET Standard
Profile2 .NETFramework 4.0 portable-net40+win8+sl4+wp7
Windows 8.0
Silverlight 4.0
WindowsPhone 7.0
Profile3 .NETFramework 4.0 portable-net40+sl4
Silverlight 4.0
Profile4 .NETFramework 4.5 portable-net45+sl4+win8+wp7
Silverlight 4.0
Windows 8.0
WindowsPhone 7.0
Profile5 .NETFramework 4.0 portable-net40+win8
Windows 8.0
Profile6 .NETFramework 4.0.3 portable-net403+win8
Windows 8.0
Profile7 .NETFramework 4.5 portable-net45+win8 netstandard1.1
Windows 8.0
Profile14 .NETFramework 4.0 portable-net40+sl5
Silverlight 5.0
Profile18 .NETFramework 4.0.3 portable-net403+sl4
Silverlight 4.0
Profile19 .NETFramework 4.0.3 portable-net403+sl5
Silverlight 5.0
Profile23 .NETFramework 4.5 portable-net45+sl4
Silverlight 4.0
Profile24 .NETFramework 4.5 portable-net45+sl5
Silverlight 5.0
Profile31 Windows 8.1 portable-win81+wp81 netstandard1.0
WindowsPhone 8.1 (SL)
Profile32 Windows 8.1 portable-win81+wpa81 netstandard1.2
WindowsPhone 8.1 (UWP)
Profile36 .NETFramework 4.0 portable-net40+sl4+win8+wp8
Silverlight 4.0
Windows 8.0
WindowsPhone 8.0 (SL)
Profile37 .NETFramework 4.0 portable-net40+sl5+win8
Silverlight 5.0
Windows 8.0
Profile41 .NETFramework 4.0.3 portable-net403+sl4+win8
Silverlight 4.0
Windows 8.0
Profile42 .NETFramework 4.0.3 portable-net403+sl5+win8
Silverlight 5.0
Windows 8.0
Profile44 .NETFramework 4.5.1 portable-net451+win81 netstandard1.2
Windows 8.1
Profile46 .NETFramework 4.5 portable-net45+sl4+win8
Silverlight 4.0
Windows 8.0
Profile47 .NETFramework 4.5 portable-net45+sl5+win8
Silverlight 5.0
Windows 8.0
Profile49 .NETFramework 4.5 portable-net45+wp8 netstandard1.0
WindowsPhone 8.0 (SL)
Profile78 .NETFramework 4.5 portable-net45+win8+wp8 netstandard1.0
Windows 8.0
WindowsPhone 8.0 (SL)
Profile84 WindowsPhone 8.1 portable-wp81+wpa81 netstandard1.0
WindowsPhone 8.1 (UWP)
Profile88 .NETFramework 4.0 portable-net40+sl4+win8+wp75
Silverlight 4.0
Windows 8.0
WindowsPhone 7.5
Profile92 .NETFramework 4.0 portable-net40+win8+wpa81
Windows 8.0
WindowsPhone 8.1 (UWP)
Profile95 .NETFramework 4.0.3 portable-net403+sl4+win8+wp7
Silverlight 4.0
Windows 8.0
WindowsPhone 7.0
Profile96 .NETFramework 4.0.3 portable-net403+sl4+win8+wp75
Silverlight 4.0
Windows 8.0
WindowsPhone 7.5
Profile102 .NETFramework 4.0.3 portable-net403+win8+wpa81
Windows 8.0
WindowsPhone 8.1 (UWP)
Profile104 .NETFramework 4.5 portable-net45+sl4+win8+wp75
Silverlight 4.0
Windows 8.0
WindowsPhone 7.5
Profile111 .NETFramework 4.5 portable-net45+win8+wpa81 netstandard1.1
Windows 8.0
WindowsPhone 8.1 (UWP)
Profile136 .NETFramework 4.0 portable-net40+sl5+win8+wp8
Silverlight 5.0
Windows 8.0
WindowsPhone 8.0 (SL)
Profile143 .NETFramework 4.0.3 portable-net403+sl4+win8+wp8
Silverlight 4.0
Windows 8.0
WindowsPhone 8.0 (SL)
Profile147 .NETFramework 4.0.3 portable-net403+sl5+win8+wp8
Silverlight 5.0
Windows 8.0
WindowsPhone 8.0 (SL)
Profile151 NETFramework 4.5.1 portable-net451+win81+wpa81 netstandard1.2
Windows 8.1
WindowsPhone 8.1 (UWP)
Profile154 .NETFramework 4.5 portable-net45+sl4+win8+wp8
Silverlight 4.0
Windows 8.0
WindowsPhone 8.0 (SL)
Profile157 Windows 8.1 portable-win81+wp81+wpa81 netstandard1.0
WindowsPhone 8.1 (SL)
WindowsPhone 8.1 (UWP)
Profile158 .NETFramework 4.5 portable-net45+sl5+win8+wp8
Silverlight 5.0
Windows 8.0
WindowsPhone 8.0 (SL)
Profile225 .NETFramework 4.0 portable-net40+sl5+win8+wpa81
Silverlight 5.0
Windows 8.0
WindowsPhone 8.1 (UWP)
Profile240 .NETFramework 4.0.3 portable-net403+sl5+win8+wpa8
Silverlight 5.0
Windows 8.0
WindowsPhone 8.1 (UWP)
Profile255 .NETFramework 4.5 portable-net45+sl5+win8+wpa81
Silverlight 5.0
Windows 8.0
WindowsPhone 8.1 (UWP)
Profile259 .NETFramework 4.5 portable-net45+win8+wpa81+wp8 netstandard1.0
Windows 8.0
WindowsPhone 8.1 (UWP)
WindowsPhone 8.0 (SL)
Profile328 .NETFramework 4.0 portable-net40+sl5+win8+wpa81+wp8
Silverlight 5.0
Windows 8.0
WindowsPhone 8.1 (UWP)
WindowsPhone 8.0 (SL)
Profile336 .NETFramework 4.0.3 portable-net403+sl5+win8+wpa81+wp8
Silverlight 5.0
Windows 8.0
WindowsPhone 8.1 (UWP)
WindowsPhone 8.0 (SL)
Profile344 .NETFramework 4.5 portable-net45+sl5+win8+wpa81+wp8
Silverlight 5.0
Windows 8.0
WindowsPhone 8.1 (UWP)
WindowsPhone 8.0 (SL)

さらに、Xamarin をターゲットとする NuGet パッケージでは、Xamarin で定義された他のフレームワークも使用することができます。 Xamarin 用の NuGet パッケージの作成に関するページを参照してください。

名前 説明 .NET Standard
monoandroid Android OS の Mono サポート netstandard1.4
monotouch iOS の Mono サポート netstandard1.4
monomac OSX の Mono サポート netstandard1.4
xamarinios Xamarin for iOS のサポート netstandard1.4
xamarinmac Xamarin for Mac のサポート netstandard1.4
xamarinpsthree Playstation 3 上の Xamarin のサポート netstandard1.4
xamarinpsfour Playstation 4 上の Xamarin のサポート netstandard1.4
xamarinpsvita PS Vita 上の Xamarin のサポート netstandard1.4
xamarinwatchos Xamarin for Watch OS netstandard1.4
xamarintvos Xamarin for TV OS netstandard1.4
xamarinxboxthreesixty Xamarin for XBox 360 netstandard1.4
xamarinxboxone Xamarin for XBox One netstandard1.4

Note

Stephen Cleary により、対応しる PCL をリスト表示するツールが作成されました。このツールは、「Framework profiles in .NET」(.NET のフレームワーク プロファイル) の投稿に掲載されています。