Why can't the target framework of a WinUI app be changed?

Hong 1,436 Reputation points
2025-12-06T16:38:32.9233333+00:00

When I try to change the target framework of a WinUI app from .NET 8.0 to anything else, it reverts to .NET 8.0 instantly.

For example, I installed .NET 10.0, restarted Visual Studio, and tried to change the target framework to .NET 10.0, but VS changed it back to .NET 8.0 immediately.

Could anyone shed some light on this?

User's image

image

Windows development | WinUI
{count} votes

Answer accepted by question author
  1. Raymond Huynh (WICLOUD CORPORATION) 3,955 Reputation points Microsoft External Staff Moderator
    2025-12-08T09:29:38.7133333+00:00

    Hello Hong,

    Thanks for writing up your issue so clearly. There are publicly documented compatibility problems that can prevent a WinUI 3 / Windows App SDK project from successfully changing target framework under newer .NET versions, especially when older RuntimeIdentifiers (RIDs) remain. Here’s what I found:

    • Starting in .NET 8 (and later), the .NET SDK switched to using a smaller “portable” RID graph. That means version-specific or OS-version-specific RIDs (like win10-x64, win10-arm64 etc.) are no longer valid by default. Projects using them may get build errors such as: NETSDK1083: The specified RuntimeIdentifier 'win10-x64' is not recognized. Documentation: .NET SDK uses a smaller RID graph https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/rid-graph
    • This exact error has been observed on freshly created WinUI templates targeting .NET 8. For example: issue “WinUI project template does not build when .Net 8 is selected” reports that the template-generated project fails to compile because the RIDs win10-x86, win10-x64, and win10-arm64 are not recognized. See https://github.com/microsoft/WindowsAppSDK/issues/3994

    If your WinUI / Windows App SDK project was created with older RID values (e.g. win10-x64 / win10-arm64), upgrading to .NET 8 (or newer) without updating the RIDs likely causes the SDK to reject the configuration. Please try these steps:

    1. Open your .csproj with a text editor (instead of using the GUI).
    2. Find your <RuntimeIdentifiers> (or <RuntimeIdentifier>) tag.
    3. Replace old RID values like win10-x64, win10-x86, win10-arm64 with the newer portable ones: win-x64, win-x86, win-arm64.
    4. Save, reload the project, and attempt to retarget / build again.

    If after updating RIDs you still can’t change the Target Framework (or get other build/runtime issues), the most reliable workaround is to create a fresh WinUI 3 project under your current Visual Studio + .NET SDK version, then migrate your code/assets over. That way you avoid hidden legacy metadata, packaging/RID issues and other upgrade-path pitfalls.

     

    Hope this helps you move forward and good luck with the migration! 


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.