Resources help

I am wanting to add my pictures as resources to my project. I believe, could be wrong, that will will deploy the images with the exe. If this is the case, how do I reference the images within the software and deploy them with the exe.

If there is a better way to deploy my images with my exe,  please let me know.


Answer this question

Resources help

  • redfish

    If you add images as resources, they become a part of the assembly (.exe or .dll)

    You reference them using <Any object belonging to that assembly>.GetType().Assembly.GetManifestResourceStream(resourceName)

    To figure out resource name use the following rules:

    If your assembly uses default namespace (in the project properties) of say MyNamespace.MyResourceAssembly and the images are located in a folder Images and one of the images is called Logo.bmp then you address it as:

    "MyNamespace.MyResourceAssembly.Images.Logo.bmp" (everything including file name is case-sensitive)

    You can also load the resource assembly explicitly using Assembly.LoadFrom(path) or get to it using Assembly.GetExecutingAssembly()



  • Resources help