Upgrade C# projects to .NET 10 - #12924
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR advances #12713 by modernizing a set of C# snippet projects—primarily converting legacy .NET Framework project files to SDK-style projects targeting .NET 10, and updating a few WCF-related snippets to be runnable/compilable in modern .NET.
Changes:
- Upgrade several snippet
.csprojfiles to SDK-style and retarget tonet10.0/net10.0-windows. - Modernize parts of the WCF snippets (CoreWCF-based hosting for
faultcontractattribute, and programmatic client/channel setup in some samples). - Remove legacy .NET Framework-era ancillary content (for example, the XBAP readme) and minor code cleanups (unused using, accessibility changes).
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/services.cs | Switch to CoreWCF types and adjust the fault contract/service implementation. |
| snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/hostapplication.cs | Replace ServiceHost hosting with ASP.NET Core + CoreWCF hosting. |
| snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/host.csproj | Convert host project to SDK-style Web project targeting net10.0 with CoreWCF packages. |
| snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Client/client.csproj | Convert client project to SDK-style targeting net10.0 and add WCF client packages. |
| snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/proxycode.cs | Remove config-based proxy constructors to better align with modern usage patterns. |
| snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/iendpointbehaviormessageinspector.cs | Refactor endpoint behavior/message inspector implementation for modern .NET. |
| snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/client.csproj | Convert client project to SDK-style targeting net10.0 and add required packages. |
| snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/client.cs | Change client to create binding/address programmatically rather than relying on config. |
| snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.csproj | Convert client project to SDK-style targeting net10.0 and add WCF client packages. |
| snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs | Update duplex client creation to be more “modern .NET”-friendly (programmatic setup). |
| snippets/csharp/System.Windows/TextAlignment/Overview/FlowDocumentSnippets.csproj | Convert WPF snippet project to SDK-style and retarget to net10.0-windows. |
| snippets/csharp/System.Windows.Documents/Hyperlink/NavigateUri/Readme.txt | Remove legacy XBAP/.NET Framework 3.0 readme content. |
| snippets/csharp/System.Windows.Automation/AutomationEventArgs/.ctor/ElementProvider.csproj | Convert WinForms snippet project to SDK-style net10.0-windows. |
| snippets/csharp/System.Windows.Automation/AndCondition/.ctor/CustomElementClient.csproj | Convert Windows desktop client snippet project to SDK-style net10.0-windows. |
| snippets/csharp/System.Windows.Automation/AndCondition/.ctor/ClientForm.cs | Minor cleanup (remove unused using). |
Suppressed comments (1)
snippets/csharp/VS_Snippets_CFX/channelfactorybehaviors/cs/iendpointbehaviormessageinspector.cs:16
- This type is referenced as a config-based behavior extension in
hostapplication.exe.config(<behaviorExtensions><add ... type="Microsoft.WCF.Documentation.EndpointBehaviorMessageInspector, HostApplication" />). RemovingBehaviorExtensionElementand theBehaviorType/CreateBehavioroverrides means the<endpointMessageInspector />element can no longer be instantiated from config, andApplyDispatchBehavioris now a no-op so the service-side inspector won’t be applied.
class EndpointBehaviorMessageInspector : IEndpointBehavior, IClientMessageInspector
{
//<snippet4>
// IEndpointBehavior Members
public void AddBindingParameters(ServiceEndpoint serviceEndpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
2 tasks
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…otnet-api-docs into upgrade-csharp-netfx-projects
adegeo
approved these changes
Aug 3, 2026
adegeo
approved these changes
Aug 4, 2026
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 #12713.