Skip to content

Upgrade projects to .NET 10 (remainder)#12812

Open
gewarren wants to merge 2 commits into
dotnet:mainfrom
gewarren:upgrade-csharp-set23
Open

Upgrade projects to .NET 10 (remainder)#12812
gewarren wants to merge 2 commits into
dotnet:mainfrom
gewarren:upgrade-csharp-set23

Conversation

@gewarren

Copy link
Copy Markdown
Collaborator

Contributes to #12513.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR continues the repo-wide migration of snippet projects to .NET 10 as part of issue #12513, updating remaining snippet .csproj files to target net10.0 (and net10.0-windows where applicable) so the snippets compile against the current .NET baseline used for validation.

Changes:

  • Updated many C# snippet projects from net6.0/net7.0/net9.0/net48/net472 to net10.0 (or net10.0-windows).
  • Standardized some projects that previously used TargetFrameworks (single entry) to TargetFramework.
  • Moved Windows-only snippet projects to Windows TFMs (in several places), though a few projects still need follow-up fixes to remove legacy <Reference Include="..."> usage (see PR comments).

Reviewed changes

Copilot reviewed 83 out of 83 changed files in this pull request and generated no comments.

Show a summary per file
File Description
snippets/csharp/System.Timers/Timer/Stop/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Timers/Timer/AutoReset/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Timers/ElapsedEventHandler/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.ServiceProcess/SessionChangeDescription/Overview/Project.csproj Update snippet TFM to net10.0-windows
snippets/csharp/System.ServiceProcess/ServiceController/Overview/Project.csproj Update snippet TFM to net10.0-windows
snippets/csharp/System.ServiceProcess/ServiceController/ExecuteCommand/Project.csproj Update snippet TFM to net10.0-windows
snippets/csharp/System.ServiceProcess/ServiceController/DependentServices/Project.csproj Update snippet TFM to net10.0-windows
snippets/csharp/System.Resources/ResXResourceSet/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Resources/ResXResourceReader/BasePath/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Resources/ResXDataNode/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Resources/ResourceWriter/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Resources/ResourceWriter/Generate/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Resources/ResourceWriter/Dispose/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Resources/ResourceWriter/AddResourceData/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Resources/ResourceWriter/.ctor/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Resources/ResourceSet/.ctor/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Resources/ResourceReader/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Resources/ResourceReader/Close/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Resources/ResourceManager/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Resources/ResourceManager/GetResourceSet/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Resources/ResourceManager/GetObject/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Resources/MissingSatelliteAssemblyException/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Printing/PrintQueue/AddJob/Project.csproj Update snippet TFM to net10.0-windows
snippets/csharp/System.Printing/LocalPrintServer/Overview/XpsPrint.csproj Update snippet TFM to net10.0-windows
snippets/csharp/System.Numerics/Complex/Zero/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/Reciprocal/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/Pow/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/op_Inequality/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/op_Implicit/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/op_Explicit/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/One/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/ImaginaryOne/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/Imaginary/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/FromPolarCoordinates/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/Exp/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/Conjugate/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/Atan/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/Asin/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/Acos/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/Abs/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/Complex/.ctor/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/ToString/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/ToByteArray/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/Remainder/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/op_OnesComplement/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/op_Implicit/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/op_Explicit/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/op_BitwiseAnd/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/ModPow/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/Min/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/Max/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/LogMethod/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/Divide/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/Compare/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/Add/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Numerics/BigInteger/.ctor/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Media/SystemSound/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Media/SoundPlayer/PlaySync/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Media/SoundPlayer/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Linq/Queryable/AggregateTSource/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Linq/LookupTKey,TElement/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Linq/IOrderedEnumerableTElement/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Linq/ILookupTKey,TElement/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Linq/IGroupingTKey,TElement/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Linq/Enumerable/UnionBy/Enumerable.csproj Update snippet TFM to net10.0
snippets/csharp/System.Linq/Enumerable/MinBy/Enumerable.csproj Update snippet TFM to net10.0
snippets/csharp/System.Linq/Enumerable/MaxBy/Enumerable.csproj Update snippet TFM to net10.0
snippets/csharp/System.Linq/Enumerable/CountBy/Enumerable.csproj Update snippet TFM to net10.0
snippets/csharp/System.Linq/Enumerable/Comparers/Comparers.csproj Update snippet TFM to net10.0 (single TFM)
snippets/csharp/System.Linq/Enumerable/AggregateTSource/Enumerable.csproj Update snippet TFM to net10.0
snippets/csharp/System.Linq/Enumerable/AggregateBy/Enumerable.csproj Update snippet TFM to net10.0
snippets/csharp/System.Linq.Expressions/BlockExpression/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Linq.Expressions/BinaryExpression/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Dynamic/ExpandoObject/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Dynamic/DynamicObject/Overview/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Data/DataTableExtensions/AsEnumerable/Project.csproj Update snippet TFM to net10.0
snippets/csharp/System.Data/ConstraintCollection/Overview/project.csproj Update snippet TFM to net10.0-windows
snippets/csharp/System.Data/ConstraintCollection/Add/project.csproj Update snippet TFM to net10.0-windows
snippets/csharp/System.Data/Constraint/ToString/project.csproj Update snippet TFM to net10.0-windows
snippets/csharp/System.Data/Constraint/Table/project.csproj Update snippet TFM to net10.0-windows
snippets/csharp/System.Data/Constraint/SetDataSet/project.csproj Update snippet TFM to net10.0-windows
snippets/csharp/System.Data/Constraint/Overview/project.csproj Update snippet TFM to net10.0-windows
snippets/csharp/System.Data/Constraint/ConstraintName/project.csproj Update snippet TFM to net10.0-windows
Comments suppressed due to low confidence (12)

snippets/csharp/System.Media/SoundPlayer/Overview/Project.csproj:9

  • This SDK-style project now targets net10.0 but still references System.Windows.Forms via a raw <Reference>. For netX TFMs, WinForms is only available when targeting a Windows TFM (for example, net10.0-windows) and enabling WinForms with <UseWindowsForms>true</UseWindowsForms>. As-is, the reference is likely to be unresolved during build.
    <TargetFramework>net10.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Reference Include="System.Windows.Forms" />

snippets/csharp/System.Media/SoundPlayer/PlaySync/Project.csproj:9

  • This SDK-style project now targets net10.0 but still references System.Windows.Forms via a raw <Reference>. For netX TFMs, WinForms is only available when targeting a Windows TFM (for example, net10.0-windows) and enabling WinForms with <UseWindowsForms>true</UseWindowsForms>. As-is, the reference is likely to be unresolved during build.
    <TargetFramework>net10.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Reference Include="System.Windows.Forms" />

snippets/csharp/System.Media/SystemSound/Overview/Project.csproj:9

  • This SDK-style project now targets net10.0 but still references System.Windows.Forms via a raw <Reference>. For netX TFMs, WinForms is only available when targeting a Windows TFM (for example, net10.0-windows) and enabling WinForms with <UseWindowsForms>true</UseWindowsForms>. As-is, the reference is likely to be unresolved during build.
    <TargetFramework>net10.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Reference Include="System.Windows.Forms" />

snippets/csharp/System.Resources/ResXResourceSet/Overview/Project.csproj:9

  • This project targets net10.0 but references System.Windows.Forms. The ResX types used by these snippets (for example, ResXResourceSet, ResXResourceWriter, and ResXDataNode) are provided by the System.Windows.Extensions package on modern .NET; System.Windows.Forms won't resolve for net10.0 and will likely break the build. Consider targeting a Windows TFM and adding System.Windows.Extensions instead of a raw WinForms reference.
    snippets/csharp/System.Resources/ResXResourceReader/BasePath/Project.csproj:9
  • This project targets net10.0 but references System.Windows.Forms. The ResX types used by these snippets (for example, ResXResourceReader) are provided by the System.Windows.Extensions package on modern .NET; System.Windows.Forms won't resolve for net10.0 and will likely break the build. Consider targeting a Windows TFM and adding System.Windows.Extensions instead of a raw WinForms reference.
    snippets/csharp/System.Resources/ResXDataNode/Overview/Project.csproj:9
  • This project targets net10.0 but references System.Windows.Forms. The ResX types used by these snippets (for example, ResXDataNode and ResXResourceReader) are provided by the System.Windows.Extensions package on modern .NET; System.Windows.Forms won't resolve for net10.0 and will likely break the build. Consider targeting a Windows TFM and adding System.Windows.Extensions instead of a raw WinForms reference.
    snippets/csharp/System.Resources/ResourceManager/Overview/Project.csproj:9
  • This project targets net10.0 but still references System.Windows.Forms via a raw <Reference>. These snippets include WinForms usage (for example, the Form/PictureBox sample in getstream.cs), so the project should use a Windows TFM and enable WinForms with <UseWindowsForms>true</UseWindowsForms> rather than referencing the assembly directly.
    snippets/csharp/System.Resources/ResourceManager/GetObject/Project.csproj:10
  • This SDK-style project targets net10.0 but still includes a raw <Reference Include="System.Windows.Forms" />. Since this snippet project doesn’t use WinForms APIs, the reference is unnecessary and is likely to become an unresolved reference under net10.0 (breaking the build or producing MSBuild warnings).
    snippets/csharp/System.ServiceProcess/ServiceController/Overview/Project.csproj:9
  • After moving to net10.0-windows, the raw assembly references (System.Management, System.ServiceProcess) are unlikely to resolve (they’re not reference assemblies in netX). Use NuGet package references instead (for example, System.ServiceProcess.ServiceController and System.Diagnostics.EventLog) to keep snippet compilation working.
    snippets/csharp/System.ServiceProcess/ServiceController/ExecuteCommand/Project.csproj:9
  • After moving to net10.0-windows, the raw assembly references (System.Management, System.ServiceProcess) are unlikely to resolve (they’re not reference assemblies in netX). Use the System.ServiceProcess.ServiceController NuGet package instead so the snippet continues to compile.
    snippets/csharp/System.ServiceProcess/ServiceController/DependentServices/Project.csproj:9
  • After moving to net10.0-windows, the raw assembly references (System.Management, System.ServiceProcess) are unlikely to resolve (they’re not reference assemblies in netX). Use NuGet package references instead (for example, System.ServiceProcess.ServiceController and System.Management) so the snippet continues to compile.
    snippets/csharp/System.ServiceProcess/SessionChangeDescription/Overview/Project.csproj:9
  • After moving to net10.0-windows, the raw assembly references (System.Management, System.ServiceProcess) are unlikely to resolve (they’re not reference assemblies in netX). Use NuGet package references instead (for example, System.ServiceProcess.ServiceController and System.Diagnostics.EventLog) so the snippet continues to compile.

@gewarren gewarren marked this pull request as ready for review June 25, 2026 22:22
@gewarren gewarren requested a review from a team as a code owner June 25, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants