Skip to content

Designer does not recognize resources from sub-projects. #3862

Closed

Description

@itg-assistant

Kizaemon Date asked 2022-09-24 04:40:15 UTC

Dear Team,

From my main "eMain" project I have moved all images to a dependent sub-project "eResources", so I can better share the images across main projects.

Before the change, the Designer has happily referenced the images using the generated resource property.

this.colDownload.CellImage = global::eMain.Diagona.diagona_icons_190;

During migration, I have manually replaced the references to the sub-project.
And this works correctly.

this.colDownload.CellImage = global::eResources.Diagona.diagona_icons_190;

But the problem now is that the Designer seem not to recognize the resources from sub-projects.
It forcefully embeds the image locally into the form, each time I open the Designer.

this.colDownload.CellImage = ((System.Drawing.Image)(resources.GetObject("colDownload.CellImage")));

I wonder if there is a way to persuade the Designer to recognize the sub-projects?

If necessary, I can create a small sample solution.

Regards,

Kizaemon

Activity

  1. itg-assistant commented on Jun 15, 2026

    @itg-assistant
    Author

    Frank (ITG) answered 2022-09-26 10:59:28 UTC

    Hi Kizaemon,

    can you please wrap up a small sample as you suggested. This will speed up the process on our side and we´ll take a closer look at it.

    Thanks in advance,
    Frank

  2. itg-assistant commented on Jun 15, 2026

    @itg-assistant
    Author

    Kizaemon Date answered 2022-09-26 14:02:48 UTC

    Hi Frank,

    thank you very much.

    A simple project is attached.

    Please see Page1 of the eMaster main app.

    The resources in the eResources library are generated using PublicResXFileCodeGenerator, and so are visible by the referencing libraries.

    The Select Resource dialog box does not allow selecting images from referenced projects, only from local resources.

    As mentioned before, the designer then forcefully embeds the image into local resources.GetObject(...)

    Not sure how much efforts there will be to allow the Select Resource dialog box enumerate referenced libraries for resources.

    For now, as work-around, I put the image assignment manually outside of the designer into Page constructor, just after InitializeComponent.

    public Page1()
    {
    InitializeComponent();
    this.pictureBox2.Image = global::eResources.ComputerFile.Computer_File_011;
    }

    Kizaemon

  3. itg-assistant commented on Jun 15, 2026

    @itg-assistant
    Author

    Alaa (ITG) answered 2022-09-26 21:07:02 UTC

    Hi Kizaemon,

    Your only solution would be to use the workaround.

    The behavior is the same for WinForms and Wisej.NET, where if you modify the designer code everything would be reserialized and all the changes would be lost or modified.
    That's the reason for the "do not modify the contents of this method with the code editor.* comment there!

    HTH,
    Alaa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SuggestionAn improvement to something that already works.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions