Skip to content

Commit 1ae3cee

Browse files
authored
Document that TargetFramework values are aliases that drive moniker properties (#53159)
1 parent 4dd288f commit 1ae3cee

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

docs/standard/frameworks.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Target frameworks in SDK-style projects - .NET
33
description: Learn about target frameworks for .NET apps and libraries.
4-
ms.date: 11/06/2025
4+
ms.date: 04/15/2026
55
ms.service: dotnet
66
ms.custom: updateeachrelease
77
ms.subservice: standard-library
@@ -208,6 +208,35 @@ public class MyClass
208208
}
209209
```
210210

211+
### TargetFramework values are aliases
212+
213+
The `TargetFramework` property value (for example, `net10.0`) is a friendly name—an alias—that the .NET SDK translates into canonical moniker properties. Specifically, the SDK sets the following properties from the `TargetFramework` value:
214+
215+
- `TargetFrameworkMoniker` (for example, `.NETCoreApp,Version=v10.0`)
216+
- `TargetFrameworkIdentifier` (for example, `.NETCoreApp`)
217+
- `TargetFrameworkVersion` (for example, `v10.0`)
218+
- `TargetPlatformMoniker`, `TargetPlatformIdentifier`, and `TargetPlatformVersion` (when targeting a specific platform)
219+
220+
NuGet and the .NET SDK use these moniker properties—not the `TargetFramework` string—for package compatibility checks and build logic. This translation already happens for OS-specific TFMs. For example, `net10.0-windows` translates to `TargetFrameworkMoniker` = `.NETCoreApp,Version=v10.0` and `TargetPlatformMoniker` = `Windows,Version=7.0`.
221+
222+
Because the alias is just a name, the `TargetFramework` value can be any alphanumeric string, as long as the corresponding moniker properties are set correctly. The following project file uses a custom alias named `banana` and explicitly sets the moniker properties so that the project builds and restores for .NET 10.0:
223+
224+
```xml
225+
<Project Sdk="Microsoft.NET.Sdk">
226+
<PropertyGroup>
227+
<TargetFramework>banana</TargetFramework>
228+
</PropertyGroup>
229+
230+
<PropertyGroup Condition=" '$(TargetFramework)' == 'banana' ">
231+
<TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>
232+
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
233+
<TargetFrameworkMoniker>.NETCoreApp,Version=v10.0</TargetFrameworkMoniker>
234+
</PropertyGroup>
235+
</Project>
236+
```
237+
238+
For more information about these properties, see the [TargetFramework](../core/project-sdk/msbuild-props.md#targetframework) MSBuild property reference.
239+
211240
## Preprocessor symbols
212241

213242
The build system is aware of preprocessor symbols representing the target frameworks shown in the [Supported target framework versions](#supported-target-frameworks) table when you're using SDK-style projects. To convert a .NET Standard, .NET Core, or .NET 5+ TFM to a preprocessor symbol, replace dots and hyphens with an underscore, and change lowercase letters to uppercase (for example, the symbol for `netstandard2.0` is `NETSTANDARD2_0`).

0 commit comments

Comments
 (0)