How Remove WinRT APIs from .NET 6 Project.

RogerSchlueter-7899 1,236 Reputation points
2022-09-14T23:21:44.43+00:00

I am getting this error:

Microsoft.Toolkit.Win32.UI.XamlHost.Managed.dll cannot be referenced because it uses built-in support for WinRT, which is no longer supported in .NET 5 and higher. An updated version of the component supporting .NET 5 is needed. For more information, see https://aka.ms/netsdk1149

I have been to the referenced web site and made the recommended changes to my project file. The relevant line now reads:

<TargetFramework>net6.0-windows10.0.22621.0</TargetFramework>  

I do not know additional steps I need to take to remove this error? I am aware that I may need to provide more information to allow answers but I'm not sure what else to provide. I'll be happy to add more in response to comments.

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,676 questions
{count} votes