Kim_Sunwoo
Kim_Sunwoo

Reputation: 21

VB.NET how to prevent embedded images in the executable

I'm working in a VB.NET application using Visual Studio 2017.

I'm using a lot of images in my project and if I follow the instructions that I've found in the Internet (add images to a resource file) the executable ends up weighting more than 300MB. This is a huge problem because when I want to send updates to the users they have to download every time 300MB instead of just a few KB, and perhaps some additional images.

I would prefer the images to be stored separately from the executable, in the same folder, but this does not seem to be possible because using the resource file and building a release version they all get eaten inside the executable.

(Note that I need the images to show while working on the designer module, so it is not an option to load them all through code using image.fromfile, which would do exactly what I want)

Can someone point me in the right direction? Thanks a lot in advance.

Upvotes: 1

Views: 157

Answers (1)

Olivier Jacot-Descombes
Olivier Jacot-Descombes

Reputation: 112632

You can create a separate class library project in the same solution. A class library project is compiled to a DLL. Include the image resources in this library project and add it as project reference to the main project.

If the image resources don't change, you don't need to re-distribute this DLL.


A trick that could enable you to use these resources at design time could be to use satellite assemblies for culture specific resources (I never tried it so). In your case you would have only on single culture.

See:

Upvotes: 3

Related Questions