Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to 8.0 #71507

Merged
merged 17 commits into from
Jan 12, 2024
Merged

Move to 8.0 #71507

merged 17 commits into from
Jan 12, 2024

Conversation

jaredpar
Copy link
Member

@jaredpar jaredpar commented Jan 5, 2024

This updates our TFMS to recognize that .NET 8 has shipped and .NET 6 is no longer supported.

At the same time I am trying to update our code base to be more driven off of $(NetCurrent) and $(NetPrevious). This is important for source build and VMR work as these properties are often overriden to drive the larger build efforts. Hard coded .NET Core based TFMs interfere with that and cause friction for those teams.

Note: this PR is being discussed in the following teams thread

Please begin the review by reading the changes to the Target Framework Strategy.md file as that largely outlines the change here.

VS Validation Build
VS Test Insertion

Comment on lines 14 to 17
# Picking the right TargetFramework
Projects in our repository should include the following values in `<TargetFramework(s)>` based on the rules below:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This documentation is great, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Glad you appreciate it. Really want to try and do this more as I do infra changes so people can better understand the rationale a few months from now.

@@ -2,16 +2,13 @@
<!-- 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>net6.0;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<TargetFrameworks>$(NetPrevious);netstandard2.0</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why this had explicit references for net6.0 and netcoreapp3.1 since it appears this is effectively a source package?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. I'm not sure what the point of the multi-target here was other than maybe to get nullable warnings. But that didn't explain why two .NET TFMs.

eng/build.ps1 Outdated
@@ -399,12 +399,12 @@ function TestUsingRunTests() {
$args += " --configuration $configuration"

if ($testCoreClr) {
$args += " --tfm net6.0 --tfm net7.0 --tfm net8.0"
$args += " --tfm net7.0 --tfm net8.0"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so so fragile. Save for the integration tests failing I would've missed that I needed to update the TFMS here.

I think this is a complication we don't really need anymore. The only real distinction we need in RunTests is framework or core. Probably going to simplify RunTests to only consider that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling that too!

@jaredpar jaredpar marked this pull request as ready for review January 9, 2024 22:26
@jaredpar jaredpar requested review from 333fred, a team and dibarbet as code owners January 9, 2024 22:26
@jaredpar
Copy link
Member Author

jaredpar commented Jan 9, 2024

@jasonmalinowski, @dibarbet, @RikkiGibson PTAL

<Otherwise>
<PropertyGroup>
<NetRoslynToolset>net8.0</NetRoslynToolset>
<NetRoslynSourceBuild>net7.0;net8.0</NetRoslynSourceBuild>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this point to $(NetVSShared), or is it possible for those to be different?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible for them to be different. Consider ~6 months into the future where

  1. DevKit has moved to net8.0
  2. Roslyn has a .NET 9 SDK preview

At that point $(NetVSShared) will simply be net8.0 but $(NetRoslynSourceBuild) will be net8.0;net9.0

- Source build: requires us to ship `$(NetCurrent)` and `$(NetPrevious)` in workspaces and below (presently `net8.0` and `net7.0` respectively)
- Visual Studio: requires us to ship `net472` for base IDE components and `net6.0` for private runtime components.
- .NET SDK: requires us to ship compilers on current servicing target framework (presently `net8.0`)
- Source build: requires us to ship `$(NetCurrent)` and `$(NetPrevious)` in workspaces and below (presently `net9.0` and `net8.0` respectively)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Source build: requires us to ship `$(NetCurrent)` and `$(NetPrevious)` in workspaces and below (presently `net9.0` and `net8.0` respectively)
- Source Build: requires us to ship workspaces and below on `$(NetCurrent)` and `$(NetPrevious)` (presently `net9.0` and `net8.0` respectively)

Since the "workspaces and below" might have been what the parenthetical applied to.


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)`
2. `$(NetVS)`: code that needs to execute on the private runtime of Visual Studio.
3. `$(NetVSCode)`: code that needs to execute in DevKit host
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. `$(NetVSCode)`: code that needs to execute in DevKit host
3. `$(NetVSCode)`: code that needs to execute in the 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.
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 ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 ...
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 ...

eng/build.ps1 Outdated
@@ -399,12 +399,12 @@ function TestUsingRunTests() {
$args += " --configuration $configuration"

if ($testCoreClr) {
$args += " --tfm net6.0 --tfm net7.0 --tfm net8.0"
$args += " --tfm net7.0 --tfm net8.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling that too!

Comment on lines +16 to +18
// The compiler must emit binary serialization metadata entries even though it doesn't
// actually do binary serialization.
#pragma warning disable SYSLIB0050
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😨

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's an interesting problem. The technology is being deprecated but compiler still has to emit and read it cause it will live forever in net472

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also surprised the compiler needs to do special stuff for this.

@@ -4,7 +4,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator</RootNamespace>
<TargetFrameworks>net7.0;net472</TargetFrameworks>
<TargetFrameworks>$(NetRoslyn);net472</TargetFrameworks>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be a place where we want a different version property here -- this is a tool that's consumed by the Code Index team, so any change to this requires a change on their side. I've verified with them they're good to take the update to 8.0 (they had already been deploying that as the newer runtime version in the last few weeks), but a change here at least means they should be notified about that.

<IsShipping>false</IsShipping>
<LangVersion>11</LangVersion>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<NoWarn>$(NoWarn);NETSDK1206</NoWarn>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a comment here.

@@ -87,7 +87,7 @@
</Target>

<!--
Deploy a net472 and net6.0 version of the BuildHost process which will be used depending on the type of project. We will use the deployed version even if
Deploy a net472 and $(NetVS) version of the BuildHost process which will be used depending on the type of project. We will use the deployed version even if
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is $(NetVS) guaranteed to be in the set of $(NetRoslynSourceBuild)?

<ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'">
<_NetFrameworkBuildHostProjectReference Include="..\..\..\Workspaces\Core\MSBuild.BuildHost\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.csproj">
<TargetFramework>net472</TargetFramework>
<ContentFolderName>BuildHost-net472</ContentFolderName>
</_NetFrameworkBuildHostProjectReference>
<_NetFrameworkBuildHostProjectReference Include="..\..\..\Workspaces\Core\MSBuild.BuildHost\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.csproj">
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>$(NetVS)</TargetFramework>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is $(NetVS) guaranteed to be in the set of $(NetRoslynSourceBuild)? And in this case we'd need the lowest version of all of them, or otherwise we could end up with say a 7.0 targeting app that consumes this as a 7.0 library, but the underlying build host is targeting 8.0 and things are broken if the user doesn't have 8.0 on their machine too.

(Longer term, this is probably a very special case where we could leave this as hard-coded since there's little code in this and it's almost entirely just shelling out to MSBuild, but there's a bit more work that needs to happen first.)

@jaredpar
Copy link
Member Author

@jasonmalinowski really appreciate your feedback on this PR. The remaining items seem non-blocking by my reading. This is an unwieldy PR and is blocking @tmat. At this point my plan is to merge this PR as is then grab a follow up PR to clean up a few of your remaining comments. Please let me know if there is something you think is critical to get in initially.

@jasonmalinowski
Copy link
Member

@jaredpar Go for it! My bad -- I meant to send you a message affirming nothing here was blocking and you can go for a merge...and I forgot.

jaredpar and others added 7 commits January 12, 2024 08:27
This updates our TFMS to recognize that .NET 8 has shipped and .NET 6 is
no longer supported.

At the same time I am trying to update our code base to be more driven
off of `$(NetCurrent)` and `$(NetPrevious)`. This is important for
source build and VMR work as these properties are often overriden to
drive the larger build efforts. Hard coded .NET Core based TFMs
interfere with that and cause friction for those teams.
Co-authored-by: Jason Malinowski <[email protected]>
@jaredpar
Copy link
Member Author

The integration failures appear to all be known / part of the existing catastrophic failures we're seeing in other PRs. Everything else is green so merging.

@jaredpar jaredpar merged commit 5fad265 into dotnet:main Jan 12, 2024
25 of 31 checks passed
@jaredpar jaredpar deleted the tf branch January 12, 2024 21:15
@ghost ghost added this to the Next milestone Jan 12, 2024
@Cosifne Cosifne modified the milestones: Next, 17.10 P1 Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Infrastructure untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants