NuGet은 다양한 위치에서 대상 프레임워크 참조를 사용하여 패키지의 프레임워크 종속 구성 요소를 구체적으로 식별하고 격리합니다.
- 프로젝트 파일: SDK 스타일 프로젝트의 경우 .csproj 에는 대상 프레임워크 참조가 포함됩니다.
- .nuspec 매니페스트: 패키지는 프로젝트의 대상 프레임워크에 따라 프로젝트에 포함될 고유한 패키지를 나타낼 수 있습니다.
-
.nupkg 폴더 이름: 패키지 폴더 내의
lib폴더는 대상 프레임워크에 따라 이름을 지정할 수 있으며, 각 폴더에는 해당 프레임워크에 적합한 DLL 및 기타 콘텐츠가 포함됩니다. -
packages.config: 종속성의 특성은
targetframework설치할 패키지의 변형을 지정합니다.
지원되는 모든 대상 프레임워크 및 TFM 구문의 정식 목록은 SDK 스타일 프로젝트의 대상 프레임워크를 참조하세요.
TargetFramework 값은 별칭입니다.
TargetFramework 프로젝트 파일의 속성은 정식 프레임워크 ID로 변환되는 친숙한 이름(별칭)입니다. .NET SDK는 TFM(설정)과 해당하는 경우 속성을 설정 TargetFrameworkMoniker 하여 이 변환을 TargetPlatformMoniker 수행합니다.
예를 들어 작성 <TargetFramework>net10.0-windows</TargetFramework>할 때 .NET SDK는 이를 다음으로 변환합니다.
TargetFrameworkMoniker=.NETCoreApp,Version=v10.0TargetPlatformMoniker=Windows,Version=7.0
NuGet은 패키지 호환성 검사를 위해 문자열이 TargetFramework 아닌 이러한 모니커 속성을 사용합니다. 즉 TargetFramework , 모니커 속성이 올바르게 설정되는 한 값 자체는 모든 문자열이 될 수 있습니다. 예를 들어 다음 프로젝트는 유효합니다.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>banana</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'banana' ">
<TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
<TargetFrameworkMoniker>.NETCoreApp,Version=v10.0</TargetFrameworkMoniker>
</PropertyGroup>
</Project>
이 프로젝트는 값이 .NET 10.0 TargetFramework 에 대해 복원되고 빌드됩니다 banana. .NET SDK는 이미 짧은 TFM이 플랫폼 정보를 사용하여 전체 모니커로 변환되는 OS 관련 TFM과 같은 net8.0-iosnet8.0-android이 별칭 메커니즘을 사용합니다.
중복 프레임워크를 사용하는 다중 대상 지정
NuGet 7.6/.NET SDK 10.0.300부터 여러 TargetFrameworks 별칭이 동일한 유효 프레임워크로 확인될 수 있습니다. 이를 통해 다중 RID 빌드 및 다중 버전 확장 대상 지정과 같은 시나리오를 사용할 수 있습니다. 복원, 팩, 잠금 파일 및 프로젝트 참조를 사용하는 방법에 대한 자세한 내용은 여러 프레임워크 대상 지정을 참조하세요.
지원되는 프레임워크
프레임워크는 일반적으로 짧은 대상 프레임워크 모니커 또는 TFM에서 참조됩니다. .NET Standard에서는 여러 프레임워크에 대한 단일 참조를 허용하도록 TxM 으로 일반화됩니다.
메모
아래 테이블을 계산하는 NuGet 클라이언트 소스 코드는 다음 위치에 있습니다.
- 지원되는 프레임워크 이름: FrameworkConstants.cs
- 프레임워크 우선 순위 및 매핑: DefaultFrameworkMappings.cs
NuGet 클라이언트는 아래 표의 프레임워크를 지원합니다. 등가 항목은 대괄호[]에 표시됩니다. 같은 dotnet일부 도구는 일부 파일에서 정식 TFM의 변형을 사용할 수 있습니다. 예를 들어 . dotnet pack.NETCoreApp2.0.nuspecnetcoreapp2.0 다양한 NuGet 클라이언트 도구는 이러한 변형을 제대로 처리하지만 파일을 직접 편집할 때 항상 정식 TFM을 사용해야 합니다.
| 이름 | Abbreviation | TFM/TxM |
|---|---|---|
| .NET Framework | 그물 | net11 |
| 네트20 | ||
| net35 | ||
| net40 | ||
| net403 | ||
| net45 | ||
| net451 | ||
| net452 | ||
| 넷46 | ||
| net461 | ||
| net462 | ||
| net47 | ||
| net471 | ||
| net472 | ||
| net48 | ||
| Microsoft Store(Windows 스토어) | netcore | netcore [netcore45] |
| netcore45 [win, win8] | ||
| netcore451 [win81] | ||
| netcore50 | ||
| .NET MicroFramework | netmf | netmf |
| 윈도우즈 | 승리 | 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 | ||
| 그물 | net5.0 | |
| net6.0 | ||
| net7.0 | ||
| net8.0 | ||
| net9.0 | ||
| net10.0 | ||
| Tizen | Tizen | tizen3 |
| tizen4 | ||
| Native | 원주민 | 원주민 |
사용되지 않는 프레임워크
다음 프레임워크는 더 이상 사용되지 않습니다. 이러한 프레임워크를 대상으로 하는 패키지는 표시된 대체 항목으로 마이그레이션되어야 합니다.
| 사용되지 않는 프레임워크 | Replacement |
|---|---|
| aspnet50 | netcoreapp |
| aspnetcore50 | |
| dnxcore50 | |
| dnx | |
| dnx45 | |
| dnx451 | |
| dnx452 | |
| dotnet | netstandard |
| dotnet50 | |
| dotnet51 | |
| dotnet52 | |
| dotnet53 | |
| dotnet54 | |
| dotnet55 | |
| dotnet56 | |
| winrt | 승리 |
Precedence
많은 프레임워크가 서로 관련되고 호환되지만 반드시 동등한 것은 아닙니다.
| 프레임워크 | 사용할 수 있음 |
|---|---|
| uap(유니버설 Windows 플랫폼) | 윈도우 8.1 |
| wpa81 | |
| netcore50 | |
| win(Microsoft Store) | winrt |
.NET Standard (소프트웨어 개발을 위한 기술 표준)
.NET Standard 는 이진 호환 프레임워크 간의 참조를 간소화하여 단일 대상 프레임워크가 다른 프레임워크의 조합을 참조할 수 있도록 합니다. (배경의 경우 .NET 입문서 참조)
NuGet Get Nearest Framework 도구는 NuGet이 프로젝트의 프레임워크를 기반으로 패키지의 여러 사용 가능한 프레임워크 자산에서 하나의 프레임워크를 선택하는 데 사용하는 것을 시뮬레이션합니다.
dotnet 일련의 모니커는 NuGet 3.3 이하에서 사용해야 합니다. netstandard 모니커 구문은 v3.4 이상에서 사용해야 합니다.
이식 가능한 클래스 라이브러리
경고
PCL은 권장되지 않습니다. PCL이 지원되지만 패키지 작성자는 대신 netstandard를 지원해야 합니다. .NET 플랫폼 표준은 PCL의 진화이며 이식 가능한 b +c 모니커와 같은 정적 라이브러리에 연결되지 않은 단일 모니커를 사용하여 플랫폼 간에 이진 이식성을 나타냅니다.
여러 자식-대상 프레임워크를 참조하는 대상 프레임워크를 정의하기 위해 키워드는 참조된 프레임워크 portable 목록의 접두사를 지정하는 데 사용됩니다. 이러한 프레임워크에서 의도하지 않은 부작용이 발생할 수 있으므로 직접 컴파일되지 않은 추가 프레임워크를 인위적으로 포함하지 마세요.
타사에서 정의한 추가 프레임워크는 이러한 방식으로 액세스할 수 있는 다른 환경과의 호환성을 제공합니다. 또한 관련 프레임워크 Profile#의 이러한 조합을 참조하는 데 사용할 수 있는 약식 프로필 번호가 있지만 폴더의 .nuspec가독성을 줄이고 이러한 숫자를 사용하는 것은 권장되지 않습니다.
| 프로필 # | 프레임워크 | 전체 이름 | .NET Standard |
|---|---|---|---|
| 프로필2 | . 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 | |||
| 프로필5 | . 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 정의 프레임워크를 사용할 수 있습니다.
| 이름 | 설명 | .NET Standard |
|---|---|---|
| monoandroid | Android OS에 대한 Mono 지원 | netstandard1.4 |
| monotouch | iOS용 Mono 지원 | netstandard1.4 |
| monomac | OSX에 대한 Mono 지원 | netstandard1.4 |
| xamarinios | iOS용 Xamarin 지원 | netstandard1.4 |
| xamarinmac | Mac용 Xamarin 지원 | netstandard1.4 |
| xamarinpsthree | Playstation 3의 Xamarin 지원 | netstandard1.4 |
| xamarinpsfour | Playstation 4의 Xamarin 지원 | netstandard1.4 |
| xamarinpsvita | PS Vita의 Xamarin 지원 | netstandard1.4 |
| xamarinwatchos | Watch OS용 Xamarin | netstandard1.4 |
| xamarintvos | TV OS용 Xamarin | netstandard1.4 |
| xamarinxboxthreesixty | XBox 360용 Xamarin | netstandard1.4 |
| xamarinxboxone | XBox One용 Xamarin | netstandard1.4 |
메모
Stephen Cleary는 지원되는 PCL을 나열하는 도구를 만들었습니다. 이 도구는 그의 게시물인 .NET의 프레임워크 프로필에서 찾을 수 있습니다.