Upgrade projects to .NET 10 (remainder)#12812
Open
gewarren wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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/net472tonet10.0(ornet10.0-windows). - Standardized some projects that previously used
TargetFrameworks(single entry) toTargetFramework. - 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.0but still referencesSystem.Windows.Formsvia a raw<Reference>. FornetXTFMs, 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.0but still referencesSystem.Windows.Formsvia a raw<Reference>. FornetXTFMs, 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.0but still referencesSystem.Windows.Formsvia a raw<Reference>. FornetXTFMs, 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.0but referencesSystem.Windows.Forms. The ResX types used by these snippets (for example,ResXResourceSet,ResXResourceWriter, andResXDataNode) are provided by theSystem.Windows.Extensionspackage on modern .NET;System.Windows.Formswon't resolve fornet10.0and will likely break the build. Consider targeting a Windows TFM and addingSystem.Windows.Extensionsinstead of a raw WinForms reference.
snippets/csharp/System.Resources/ResXResourceReader/BasePath/Project.csproj:9 - This project targets
net10.0but referencesSystem.Windows.Forms. The ResX types used by these snippets (for example,ResXResourceReader) are provided by theSystem.Windows.Extensionspackage on modern .NET;System.Windows.Formswon't resolve fornet10.0and will likely break the build. Consider targeting a Windows TFM and addingSystem.Windows.Extensionsinstead of a raw WinForms reference.
snippets/csharp/System.Resources/ResXDataNode/Overview/Project.csproj:9 - This project targets
net10.0but referencesSystem.Windows.Forms. The ResX types used by these snippets (for example,ResXDataNodeandResXResourceReader) are provided by theSystem.Windows.Extensionspackage on modern .NET;System.Windows.Formswon't resolve fornet10.0and will likely break the build. Consider targeting a Windows TFM and addingSystem.Windows.Extensionsinstead of a raw WinForms reference.
snippets/csharp/System.Resources/ResourceManager/Overview/Project.csproj:9 - This project targets
net10.0but still referencesSystem.Windows.Formsvia a raw<Reference>. These snippets include WinForms usage (for example, theForm/PictureBoxsample ingetstream.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.0but 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 undernet10.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 innetX). Use NuGet package references instead (for example,System.ServiceProcess.ServiceControllerandSystem.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 innetX). Use theSystem.ServiceProcess.ServiceControllerNuGet 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 innetX). Use NuGet package references instead (for example,System.ServiceProcess.ServiceControllerandSystem.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 innetX). Use NuGet package references instead (for example,System.ServiceProcess.ServiceControllerandSystem.Diagnostics.EventLog) so the snippet continues to compile.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributes to #12513.