Skip to content

Upgrade C# projects to .NET 10 - #12924

Merged
gewarren merged 7 commits into
dotnet:mainfrom
gewarren:upgrade-csharp-netfx-projects
Aug 4, 2026
Merged

Upgrade C# projects to .NET 10#12924
gewarren merged 7 commits into
dotnet:mainfrom
gewarren:upgrade-csharp-netfx-projects

Conversation

@gewarren

Copy link
Copy Markdown
Collaborator

Contributes to #12713.

Copilot AI review requested due to automatic review settings July 31, 2026 21:17
@gewarren
gewarren requested a review from a team as a code owner July 31, 2026 21:17

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 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 .csproj files to SDK-style and retarget to net10.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" />). Removing BehaviorExtensionElement and the BehaviorType/CreateBehavior overrides means the <endpointMessageInspector /> element can no longer be instantiated from config, and ApplyDispatchBehavior is 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)

Comment thread snippets/csharp/VS_Snippets_CFX/faultcontractattribute/cs/Host/hostapplication.cs Outdated
Comment thread snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/client.cs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment thread snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/snippets.5000.json Outdated
Comment thread snippets/csharp/VS_Snippets_CFX/callbackbehaviorattribute/cs/host.csproj Outdated
@gewarren
gewarren requested a review from mconnew as a code owner August 3, 2026 21:30
@gewarren
gewarren merged commit 068c315 into dotnet:main Aug 4, 2026
7 checks passed
@gewarren
gewarren deleted the upgrade-csharp-netfx-projects branch August 4, 2026 18:02
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.

3 participants