Skip to content

Remove /clr:pure from WPF C++/CLI projects#11575

Open
vinnarayana-msft wants to merge 4 commits intodotnet:mainfrom
vinnarayana-msft:user/vinnarayana/remove-clr-pure-main
Open

Remove /clr:pure from WPF C++/CLI projects#11575
vinnarayana-msft wants to merge 4 commits intodotnet:mainfrom
vinnarayana-msft:user/vinnarayana/remove-clr-pure-main

Conversation

@vinnarayana-msft
Copy link
Copy Markdown
Contributor

@vinnarayana-msft vinnarayana-msft commented Apr 13, 2026

Description

MSVC 14.51 (VS 18.3) is removing support for /clr:pure when used with /clr:netcore. WPF is the only known consumer of /clr:pure. This PR migrates the two affected C++/CLI projects (DirectWriteForwarder.vcxproj and System.Printing.vcxproj) from /clr:pure to standard /clr:netcore (IJW mixed mode).

Changes:

  • Changed CLRSupport and CompileAsManaged from pure to NetCore in both vcxproj files
  • Updated Wpf.Cpp.props to remove the pure to NetCore conversion logic in ManagedCxx conditions
  • Removed ijwhost.dll from packaging exclusions in both vcxproj files — mixed-mode assemblies require this .NET runtime bootstrap shim to load correctly
  • Fixed ARM64 build break in intsafe_private_copy.h where _M_ARM64 was missing from an architecture detection #if condition (previously masked by _M_CEE_PURE)

Customer Impact

Without this fix, WPF will fail to build with MSVC 14.51+ (VS 18.3) since /clr:pure + /clr:netcore will no longer be a valid combination. This is a build-time breaking change from the MSVC toolset.

Regression

No. This is a proactive change to address an upcoming MSVC toolset deprecation. No existing behavior is regressed — the output DLLs function identically at runtime.

Testing

Test Result
x64 build ✅ Pass
ARM64 build compilation ✅ Pass
WPF Gallery app run (x64) ✅ Pass

Risk

Low-Medium. The change is minimal (4 files) and surgical — it only affects the two C++/CLI projects in WPF. The runtime behavior of the DLLs is functionally equivalent; the difference is the compilation mode (pure MSIL → IJW mixed mode). The primary risk is potential performance impact from losing ahead-of-time MSIL compilation.

Microsoft Reviewers: Open in CodeFlow

Migrate DirectWriteForwarder and System.Printing from /clr:pure to
/clr:netcore (IJW mixed mode) in preparation for MSVC 14.51 which
removes /clr:pure + /clr:netcore support.

Changes:
- CLRSupport and CompileAsManaged changed from pure to NetCore
- Removed pure to NetCore conversion logic in Wpf.Cpp.props
- Removed ijwhost.dll packaging exclusion (required for mixed-mode)
- Added _M_ARM64 to architecture check in intsafe_private_copy.h

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vinnarayana-msft vinnarayana-msft requested review from a team and Copilot April 13, 2026 08:47
@dotnet-policy-service dotnet-policy-service Bot added the PR metadata: Label to tag PRs, to facilitate with triage label Apr 13, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates WPF’s C++/CLI build configuration to remove reliance on deprecated /clr:pure in favor of standard /clr:netcore (IJW mixed mode), aligning with upcoming MSVC toolset behavior and unblocking future builds.

Changes:

  • Switched CLRSupport and CompileAsManaged from pure to NetCore for DirectWriteForwarder and System.Printing.
  • Simplified Wpf.Cpp.props by removing the pureNetCore remapping logic and updating ManagedCxx conditions.
  • Fixed an ARM64 compilation break by extending architecture detection in intsafe_private_copy.h.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Microsoft.DotNet.Wpf/src/System.Printing/System.Printing.vcxproj Moves the project to /clr:netcore and allows ijwhost.dll to be packaged by removing the exclusion.
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/DirectWriteForwarder.vcxproj Moves the project to /clr:netcore and allows ijwhost.dll to be packaged by removing the exclusion.
src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/TrueTypeSubsetter/TtfDelta/intsafe_private_copy.h Adds _M_ARM64 handling to prevent ARM64 build errors.
eng/WpfArcadeSdk/tools/Wpf.Cpp.props Updates shared build logic to recognize CLRSupport=NetCore and removes the old pure remap.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread eng/WpfArcadeSdk/tools/Wpf.Cpp.props Outdated
Comment on lines 57 to 61
Enable IDE support for C++/CLI .NET Core builds
-->
<PropertyGroup>
<CLRSupport Condition="'$(CLRSupport)' == 'pure'">NetCore</CLRSupport>

</PropertyGroup>
@miloush
Copy link
Copy Markdown
Contributor

miloush commented Apr 13, 2026

Can we have some link/reference to the deprecation of the combination?

Copilot AI added a commit to dotnet/dotnet that referenced this pull request Apr 20, 2026
@vinnarayana-msft
Copy link
Copy Markdown
Contributor Author

Can we have some link/reference to the deprecation of the combination?
@miloush

Please refer to this page
This page says:

/clr:pure is deprecated. The option is removed in Visual Studio 2017 and later. We recommend that you port code that must be pure MSIL to C#.

The driver also gives a deprecation warning if /clr:pure is used:

cl : Command line warning D9035 : option 'clr:pure' has been deprecated and will be removed in a future release

@vinnarayana-msft
Copy link
Copy Markdown
Contributor Author

@vinnarayana-msft please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@dotnet-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@dotnet-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@dotnet-policy-service agree company="Microsoft"

Contributor License Agreement

@dotnet-policy-service agree company="Microsoft"

Comment thread eng/WpfArcadeSdk/tools/Wpf.Cpp.props Outdated
harshit7962
harshit7962 previously approved these changes May 8, 2026
Address PR review nit: remove CLRSupport=='pure' from DllRenameClause
condition since no project sets CLRSupport to 'pure' anymore. Update
comment to reference /clr:netcore instead of /clr:pure.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vinnarayana-msft
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR metadata: Label to tag PRs, to facilitate with triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants