Search code examples
c#xamlvisual-studio-2022winui-3uno-platform

WMC9999 This member 'Resources' has more than one item, use the Items property


Well, this is my first project with WinUI and Uno platform. I'm working on a Desktop app with WinUI and want to grant it backwards compatibility with Uno, so this is why I'm sticking to Uno project template.

My problem here is after tweaking a lot of stuff that I have no idea about, I ended up with this error.

Also, I would appreciate a source I could learn all about XAML tags from.

Severity Code Description Project File Line Suppression State
Error WMC9999 This Member 'Resources' has more than one item, use the Items property AppTestUI.Windows C:\Users\hp.nuget\packages\ microsoft.windowsappsdk\1.1.5\buildTransitive\ Microsoft.UI.Xaml.Markup.Compiler.interop.targets 476
Warning WMC9999 This Member 'Resources' has more than one item, use the Items property AppTestUI.Windows C:\Users\hp.nuget\packages\ microsoft.windowsappsdk\1.1.5\buildTransitive\ Microsoft.UI.Xaml.Markup.Compiler.interop.targets 352

<Application
    x:Class="AppTestUI.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:Microsoft.UI.Xaml.Controls"
    xmlns:local="using:AppTestUI"
    xmlns:uen="using:Uno.Extensions.Navigation.UI"
    xmlns:uer="using:Uno.Extensions.Reactive.UI"
    xmlns:toolkit="using:Uno.UI.Toolkit"
    xmlns:um="using:Uno.Material"
    xmlns:utu="using:Uno.Toolkit.UI"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    >

    <Application.Resources>
        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>
                <um:MaterialColors xmlns="using:Uno.Material" />
                <um:MaterialFonts xmlns="using:Uno.Material" />
                <um:MaterialResources xmlns="using:Uno.Material" />
                <MaterialToolkitResources xmlns="using:Uno.Toolkit.UI.Material" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
        <controls:XamlControlsResources x:Key="using:Microsoft.UI.Xaml.Controls" />
        <utu:ToolkitResources x:Key="using:Uno.Toolkit.UI" />
    </Application.Resources>
</Application>


Solution

  • Try this:

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <um:MaterialColors xmlns="using:Uno.Material" />
                <um:MaterialFonts xmlns="using:Uno.Material" />
                <um:MaterialResources xmlns="using:Uno.Material" />
                <MaterialToolkitResources xmlns="using:Uno.Toolkit.UI.Material" />
            </ResourceDictionary.MergedDictionaries>
            <controls:XamlControlsResources x:Key="using:Microsoft.UI.Xaml.Controls" />
            <utu:ToolkitResources x:Key="using:Uno.Toolkit.UI" />
        </ResourceDictionary>
    </Application.Resources>