If I add an imagelist control to my project it asks me to select images from the hard disk. When my application is compiled and distributed are the images I selected serialized and/or compiled into the exe? or do the images need to reside on the end-user computer in the same location?

Dani AI

Generated

Short answer: when you add images to a Windows Forms ImageList in the designer, Visual Studio serializes them into the form/project resources and those resources are compiled into the assembly. That is why sees the EXE grow and the images still show after deleting the source files; the designer stores an ImageListStreamer in the .resx which gets embedded into the built executable or DLL (ImageList.ImageStream).

If you want to confirm where your images live, open the form's .resx (or the project Resources.resx) and look for ImageList entries, or check Properties > Resources in Visual Studio. Adding images via the Project Properties > Resources tab also embeds them and gives you strongly typed access (Properties.Resources.MyImage). Embedding is convenient for small UI icons; it packages everything into one deployable file. See the general rules for embedding resources in assemblies here: .

If you prefer the images to remain external (so they can be updated without rebuilding or to avoid inflating the EXE), add them as Content with "Copy to Output Directory" or load them at runtime from files or a satellite/resource assembly. Embedding is fine for typical icons, but avoid embedding very large images if keeping installer size small is important.

Recommended Answers

All 3 Replies

You'll need to add them to the project if you want them packaged up for distribution.

You'll need to add them to the project if you want them packaged up for distribution.

So would it be safe to add the image as a project resource, then just select the image that is in the project resources folder?

I read here that if I add images to an image list they ARE compiled into the app for distribution...is there anything official from Microsoft on this?

I think it is serializing the data into the exe...when i add images to the image list and then delete or change the name of the source image, it still works in the debug version of the application. The .exe file size also increases. But does anyone know for sure?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.