MAUI IMAGE LOAD ISSUE USING ASSEMBLY

SANJAY KUMAR JHA 0 Reputation points
2023-11-06T05:36:29.2966667+00:00

Hi,

I'm encountering a significant problem in my MAUI development. I've developed a MAUI library project, and when I reference it in another MAUI project, everything functions correctly. However, when I attempt to use the assembly or DLL within the same project, the images within the library project don't appear. I've included images in the library project, but I'm struggling to determine the root cause of this issue. I would greatly appreciate your assistance in resolving this problem. I've attached the project for your reference.

You can download project from below link

Project Path:"https://1drv.ms/u/s!AiahwLUhqFUNbf8Qp1zA-_Kr7d0?e=JmvhII"

Video link:"https://1drv.ms/v/s!AiahwLUhqFUNbKq4MvzzX112O9A?e=hNHMGo"

Thanks,

Sanjay

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,090 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,610 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,883 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,260 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
765 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 35,571 Reputation points Microsoft Vendor
    2023-11-07T03:35:10.5566667+00:00

    Hello,

    This is in line with expectations.

    The class library itself is an encapsulation of Assembly. Therefore, you could not use Assembly to reference the class library.

    Class libraries are the shared library concept for .NET. They enable you to componentize useful functionality into modules that can be used by multiple applications. They can also be used as a means of loading functionality that is not needed or not known at application startup. Class libraries are described using the .NET Assembly file format.

    This is because when referencing a class library, the project is added to the project as a shared project.

    As a shared project, it is possible to release content at compile time to individual projects that reference it.

    Unlike most other project types a shared project does not have any output (in DLL form), instead the code is compiled into each project that references it. This is illustrated in the diagram below - conceptually the entire contents of the Shared Project is "copied into" each referencing project and compiled as though it was a part of them. Quated from What is a Shared Project?.

    When a shared project is compiled to a dll and introduced into the project as assembly, the resources in the program are not released to the individual projects.

    As a result, there is an error that the image file cannot be found in it.

    /Resources/CustomLoaderImages/AuroraWaveLoaderImages/aurorawaveloaderimg_4.png: open failed: ENOENT (No such file or directory)

    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.