Why is Maui's "Colors.xml" not found building with Visual Studio Mac but is with Visual Studio Windows?

Marc George 191 Reputation points
2023-03-21T18:20:33.5833333+00:00

Using VS Mac 17.6 Preview 2, building a MAUI application, it is responding with "Resource "Resources/Styes/Colors.xml" not found (XFC0124)" as an error. Building the exact same code, just copied to the Mac for its build, with VS Windows 17.6.0 Preview 1.0, the build is successful and deploys to an iPhone. Why?

The code with the error is the App.xml file.

<?xml version = "1.0" encoding = "UTF-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:Sentry"
             x:Class="Sentry.App">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/Styles/Colors.xaml" />
                <ResourceDictionary Source="Resources/Styles/Styles.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

Developer technologies | .NET | .NET MAUI
Developer technologies | Visual Studio | Other
{count} votes

2 answers

Sort by: Most helpful
  1. no-more-moire 10 Reputation points
    2023-06-18T00:48:40.56+00:00
    In my case,
    
    1)Open my .csproj file.
    2)Find these lines.
    	<ItemGroup>
    	  <MauiXaml Remove="Resources\Styles\Styles.xaml" />
    	  <MauiXaml Remove="Resources\Styles\Colors.xaml" />
    	</ItemGroup>
    3)Delete them.
    
    But,I don't know when or how these lines added.
    
    2 people found this answer helpful.
    0 comments No comments

  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.