Visual Studio XAML COMException CLASSNOTREG

Visual Studio XAML COMException CLASSNOTREG

December 30, 2024

Building an unpackaged blank WinUI 3 project, the following exception is thrown:

System.Runtime.InteropServices.COMException: ‘Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))’

To fix this, add the following in the in the project’s .csproj:

<PropertyGroup>
...
<WindowsPackageType>None</WindowsPackageType>
...
</PropertyGroup>