Skip to content

Commit

Permalink
Update target frameworks (#72248)
Browse files Browse the repository at this point in the history
* Update target frameworks

A couple of projects that are included in source build weren't using
`$(NetRoslynSourceBuild)`.

* changes

* more
  • Loading branch information
jaredpar authored Feb 24, 2024
1 parent ae73e6a commit e8c0381
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions docs/contributing/Target Framework Strategy.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ It is not reasonable for us to take the union of all TFM and multi-target every

Projects in our repository should include the following values in `<TargetFramework(s)>` based on the rules below:

1. `$(NetRoslynSourceBuild)`: code that needs to be part of source build. This property will change based on whether the code is building in a source build context or official builds. In official builds this will include the TFMs for `$(NetVSShared)`
1. `$(NetRoslynSourceBuild)`: code that needs to be part of source build. This property will change based on whether the code is building in a source build context or official builds.
a. In official builds this will include the TFMs for `$(NetVSShared)`
b. In source builds this will include `$(NetRoslyn)`
2. `$(NetVS)`: code that needs to execute on the private runtime of Visual Studio.
3. `$(NetVSCode)`: code that needs to execute in DevKit host
4. `$(NetVSShared)`: code that needs to execute in both Visual Studio and VS Code but does not need to be source built.
5. `$(NetRoslynToolset)`: packages that ship the Roslyn toolset. The compiler often builds against multiple target frameworks. This property controls which of those frameworks are shipped in the toolset packages. This value will potentially change in source builds.
5. `$(NetRoslyn)`: code that needs to execute on .NET but does not have any specific product deployment requirements. For example utilities that are used by our infra, compiler unit tests, etc ... This property also controls which of the frameworks the compiler builds against are shipped in the toolset packages. This value will potentially change in source builds.
6. `$(NetRoslynAll)`: code, generally test utilities, that need to build for all .NET runtimes that we support.
7. `$(NetRoslyn)`: code that needs to execute on .NET but does not have any specific product deployment requirements. For example utilities that are used by our infra, compiler unit tests, etc ...
8. `$(NetRoslynBuildHostNetCoreVersion)`: the target used for the .NET Core BuildHost process used by MSBuildWorkspace.
7. `$(NetRoslynBuildHostNetCoreVersion)`: the target used for the .NET Core BuildHost process used by MSBuildWorkspace.

This properties `$(NetCurrent)`, `$(NetPrevious)` and `$(NetMinimum)` are not used in our project files because they change in ways that make it hard for us to maintain corect product deployments. Our product ships on VS and VS Code which are not captured by arcade `$(Net...)` macros. Further as the arcade properties change it's very easy for us to end up with duplicate entries in a `<TargetFarmeworks>` setting. Instead our repo uses the above values and when inside source build or VMR our properties are initialized with arcade properties.

Expand Down
8 changes: 4 additions & 4 deletions eng/targets/TargetFrameworks.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Requirements:
- NetVSShared must include both NetVS and NetVSCode
- NetRoslynSourceBuild must include NetRoslynToolset
- NetRoslynSourceBuild must include NetRoslyn
- NetRoslynAll must include all .NET Core TFMS in any property below
-->
<PropertyGroup>
Expand Down Expand Up @@ -36,7 +36,7 @@
-->
<When Condition="'$(DotNetBuildFromSource)' == 'true' AND '$(DotNetBuildFromSourceFlavor)' != 'Product'">
<PropertyGroup>
<NetRoslynToolset>$(NetPrevious)</NetRoslynToolset>
<NetRoslyn>$(NetPrevious)</NetRoslyn>
<NetRoslynSourceBuild>$(NetCurrent);$(NetPrevious)</NetRoslynSourceBuild>
<NetRoslynAll>$(NetCurrent);$(NetPrevious)</NetRoslynAll>
<NetRoslynBuildHostNetCoreVersion>$(NetPrevious)</NetRoslynBuildHostNetCoreVersion>
Expand All @@ -48,7 +48,7 @@
-->
<When Condition="'$(DotNetBuildFromSource)' == 'true' AND '$(DotNetBuildFromSourceFlavor)' == 'Product'">
<PropertyGroup>
<NetRoslynToolset>$(NetCurrent)</NetRoslynToolset>
<NetRoslyn>$(NetCurrent)</NetRoslyn>
<NetRoslynSourceBuild>$(NetCurrent);$(NetPrevious)</NetRoslynSourceBuild>
<NetRoslynAll>$(NetCurrent);$(NetPrevious)</NetRoslynAll>
<NetRoslynBuildHostNetCoreVersion>$(NetCurrent)</NetRoslynBuildHostNetCoreVersion>
Expand All @@ -62,7 +62,7 @@
-->
<Otherwise>
<PropertyGroup>
<NetRoslynToolset>net8.0</NetRoslynToolset>
<NetRoslyn>net8.0</NetRoslyn>
<NetRoslynSourceBuild>net7.0;net8.0</NetRoslynSourceBuild>
</PropertyGroup>
</Otherwise>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE file in the project root for more information. -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;$(NetRoslynToolset)</TargetFrameworks>
<TargetFrameworks>net472;$(NetRoslyn)</TargetFrameworks>

<IsPackable>true</IsPackable>
<NuspecPackageId>Microsoft.Net.Compilers.Toolset</NuspecPackageId>
Expand Down

0 comments on commit e8c0381

Please sign in to comment.