Skip to content

Commit

Permalink
[release/6.0] Introduce targeting properties (#12633)
Browse files Browse the repository at this point in the history
* Introduce targeting properties (#12161)

* Introduce targeting properties
Targeting implementation of https://github.com/dotnet/arcade/pull/11903/files.
Adds three properties to allow repos to defer some/all of their target framework maintenance to arcade.
Arcade already had a file like this for its own purposes. I've removed that and hoisted arcade's targeting property into its Directory.Build.props.

* Fixup the TFM

* Remove import
  • Loading branch information
mmitche authored Feb 21, 2023
1 parent 0c93c1c commit 5c3a033
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 15 deletions.
4 changes: 3 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />

<Import Project="$(RepositoryEngineeringDir)TargetFrameworkDefaults.props" />


<PropertyGroup>
<Copyright>$(CopyrightNetFoundation)</Copyright>
Expand All @@ -11,6 +11,8 @@
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
<LangVersion>Latest</LangVersion>
<TargetFrameworkForNETSDK>netcoreapp3.1</TargetFrameworkForNETSDK>
<TargetFrameworkForNETSDK Condition="'$(DotNetBuildFromSource)' == 'true'">net6.0</TargetFrameworkForNETSDK>

<!--
Tools and packages produced by this repository support infrastructure and are not shipping on NuGet or via any other official channel.
Expand Down
9 changes: 9 additions & 0 deletions Documentation/ArcadeSdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,15 @@ Set to `false` to override the default (uncommon).
Set to `partial` or `full` in a shipping project to require IBC optimization data to be available for the project and embed them into the binary during official build. The value of `partial` indicates partial NGEN, whereas `full` means full NGEN optimization.
### `NetCurrent/NetPrevious/NetMinimum/NetFrameworkMinimum`
Properties that define TargetFramework for use by projects so their targeting easily aligns with the current .NET version in development as well as those that are supported. Arcade will update these properties to match the current supported .NET versions, as well as the release being currently developed.
- NetCurrent - The TFM of the major release of .NET that the Arcade SDK aligns with.
- NetPrevious - The previously released version of .NET (e.g. this would be net7 if NetCurrent is net8)
- NetMinimum - Lowest supported version of .NET the time of the release of NetCurrent. E.g. if NetCurrent is net8, then NetMinimum is net6
- NetFrameworkMinimum - Lowest supported version of .NET Framework the time of the release of NetCurrent. E.g. if NetCurrent is net8, then NetFrameworkMinimum is net462
### `SkipTests` (bool)
Set to `true` in a test project to skip running tests.
Expand Down
2 changes: 0 additions & 2 deletions eng/SourceBuild.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
<SourceBuildManagedOnly>true</SourceBuildManagedOnly>
</PropertyGroup>

<Import Project="TargetFrameworkDefaults.props" />

<!--
Some MSBuild files in this repo are copied as-is into the outputs, and contain hard-coded target
framework names. For the Microsoft build, the target framework rarely (never?) changes, so it
Expand Down
12 changes: 0 additions & 12 deletions eng/TargetFrameworkDefaults.props

This file was deleted.

1 change: 1 addition & 0 deletions src/Microsoft.DotNet.Arcade.Sdk/tools/Settings.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<Import Project="ProjectDefaults.props"/>
<Import Project="Tests.props" Condition="'$(DisableArcadeTestFramework)' != 'true'" />
<Import Project="Workarounds.props"/>
<Import Project="TargetFrameworkDefaults.props"/>

<Import Project="Compiler.props" Condition="'$(UsingToolMicrosoftNetCompilers)' == 'true'" />
<Import Project="Linker.props" Condition="'$(UsingToolMicrosoftNetILLinkTasks)' == 'true'" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<!-- Repositories using the arcade SDK can stay up to date with their target framework more easily using the properties in this file.
- NetCurrent - The TFM of the major release of .NET that the Arcade SDK aligns with.
- NetPrevious - The previously released version of .NET (e.g. this would be net7 if NetCurrent is net8)
- NetMinimum - Lowest supported version of .NET the time of the release of NetCurrent. E.g. if NetCurrent is net8, then NetMinimum is net6
- NetFrameworkMinimum - Lowest supported version of .NET Framework the time of the release of NetCurrent. E.g. if NetCurrent is net8, then NetFrameworkMinimum is net462
Examples:
<TargetFrameworks>$(NetCurrent)</TargetFrameworks>
<TargetFrameworks>$(NetCurrent);net472</TargetFrameworks>
<TargetFrameworks>$(NetCurrent);$(NetPrevious);$(NetFrameworkMinimum);net472</TargetFrameworks>
-->
<PropertyGroup>
<NetCurrent>net6.0</NetCurrent>
<NetPrevious>net5.0</NetPrevious>
<NetMinimum>net3.1</NetMinimum>
<NetFrameworkMinimum>net452</NetFrameworkMinimum>
</PropertyGroup>
</Project>

0 comments on commit 5c3a033

Please sign in to comment.