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-arm64etc.) 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, andwin10-arm64are 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:
- Open your
.csprojwith a text editor (instead of using the GUI). - Find your
<RuntimeIdentifiers>(or<RuntimeIdentifier>) tag. - Replace old RID values like
win10-x64,win10-x86,win10-arm64with the newer portable ones:win-x64,win-x86,win-arm64. - 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!