none
How to define the order of resources in a resource-only DLL? RRS feed

  • Question

  • I built a resource-only dll that includes some custom format files.

    Then, in another application, I load the resource dll with...

    array<String^>^ resourceNames = SampleAssembly->GetManifestResourceNames();

    Unfortuantely the order of the names in array resourceNames is not as I would it to be.

    I need to control that order. I think I have to define the order when building the dll. One possible way would be to add a prefix string to all files (when building the dll) such as "01_fileName1", "02_fileName2xyz" and so on. Then calling the sorting method on the array...

    resourceNames->Sort(resourceNames);

    Could someone give a better and stronger way?

    Thanks.

    Wednesday, February 6, 2013 2:26 PM

All replies

  • Hi Dave,

    Welcome to the MSDN Forum.

    The order of the resource file is following the order it has been added into the assembly.

    If you need to adjust this, please try to add them to the project sequentially.

    And you can also try to build your assembly manually by MSBuild: http://msdn.microsoft.com/en-us/library/ms171482.aspx  about more information about this topic, please try here: http://social.msdn.microsoft.com/Forums/en-US/msbuild/threads

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, February 7, 2013 11:18 AM
    Moderator
  • The order of the resource file is following the order it has been added into the assembly.

    I checked the order in the csproj file. The order is right. It means that function GetManifestResourceNames() does a bad reordering. Is there an alternative?

    Thursday, February 7, 2013 12:58 PM
  • Hi Dave,

    >>Is there an alternative?

    This should be by design. And your requirement is very strange. I am afraid you don't get a work way.

    Good luck.


    Ghost,
    Call me ghost for short, Thanks
    To get the better answer, it should be a better question.

    Thursday, February 14, 2013 10:14 AM