Code inspection: Namespace should be default namespace of this project
This inspection reports a namespace in a Windows Runtime component project when the namespace that contains public WinRT types doesn't match the project's default namespace. For WinRT metadata, the root namespace of public exported types is expected to be the project's default namespace. If public types are declared under a different root namespace, the generated WinMD surface can be inconsistent or invalid.
Example
// Project default namespace: WindowsRuntimeComponent
namespace MyCompany.Feature
{
public sealed class Demo
{
}
}
// Project default namespace: WindowsRuntimeComponent
namespace WindowsRuntimeComponent.Feature
{
public sealed class Demo
{
}
}
How to fix
There is no dedicated quick-fix. The usual fix is to move public WinRT types under the project's default namespace or change the project's default namespace to match the intended WinRT API root.
21 April 2026