MAUI .NET resource file

MacSlacky 20 Reputation points
2023-05-07T18:38:49.0166667+00:00

I have to change resource folders for icon, image and splash screen I read in the manual that you just need to modify the app project file by inserting for example the following code:

    <ItemGroup>
         <MauiSplashScreen Include="Resources\Splash\*" />
    </ItemGroup>

I can't understand and find this file it should have xml extension Thanks for your help

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,231 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 39,391 Reputation points Microsoft Vendor
    2023-05-09T06:05:35.8433333+00:00

    Hello,

    As described in the official MAUI splash screen documentation, you need to add this code into the project file:

    This creates a corresponding entry in your project file:

    <ItemGroup>
      <MauiSplashScreen Include="Resources\Splash\splashscreen.svg" />
    </ItemGroup>
    

    For editing project file, you could refer to the following methods to do it:

    Method 1. In visual studio, you could double-click your project folder in Solution Explorer to edit your project file.

    Method 2. You could right click on your project name and click on Edit Project File.

    Method 3. You could open the folder where your MAUI project is located directly using Explorer, after which you could see a file with the suffix csproj, and you could modify the project file directly using a text editor.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. VasimTamboli 4,785 Reputation points
    2023-05-07T19:12:31.8433333+00:00

    The resource file you are referring to is an XML file that contains information about the resources used by your Maui .NET application. This file is typically named "App.xaml" and is located in the "Resources" folder of your Maui project.

    To modify the resource folders for icons, images, and splash screens, you can add the following code to your App.xaml file:

    <Application.Resources>
        <ResourceDictionary>
            <MauiSplashScreen Include="Resources\Splash\*" />
            <MauiImage Include="Resources\Images\*" />
            <MauiIcon Include="Resources\Icons\*" />
        </ResourceDictionary>
    </Application.Resources>
    

    This code defines three different resource types: MauiSplashScreen, MauiImage, and MauiIcon. Each of these types includes a set of files that are located in the specified folders.

    Note that you will need to replace the folder paths in the code above with the actual paths to your resource folders. Once you have made these changes, you should be able to use the new resources in your Maui .NET application.