targetFramework
TargetFramework is an attribute used in .NET project files (.csproj, .vbproj, etc.) to specify the version of the .NET platform that the application or library is built against. It is declared within a PropertyGroup element as follows: <TargetFramework>net6.0</TargetFramework>. The value indicates the framework moniker, a standardized string that encodes the platform name and version, such as net48 for .NET Framework 4.8, netcoreapp3.1 for .NET Core 3.1, or net5.0 for .NET 5. This information enables build tools, IDEs, and the .NET runtime to resolve package references, compile code with the correct language features, and enforce API availability constraints.
When the property is set, the build system automatically activates the corresponding framework reference assemblies and
The TargetFramework value is strongly tied to the SDK and tooling ecosystem. An invalid or unsupported moniker