1.5. Embed a Resource File in an Assembly

Problem

You need to create a string-based resource file and embed it in an assembly.

Solution

Use the Resource Generator (resgen.exe) to create a compiled resource file. You then use the /resource switch of the compiler to embed the file in the assembly.

NOTE

The Assembly Linker tool (al.exe) also provides functionality for working with and embedding resource files. Refer to the Assembly Linker information in the .NET Framework SDK documentation for details.

How It Works

If you need to store strings in an external file and have them accessible to your assembly, you can use a resource file. Resources are some form of data (a string or an image, for example) that is used by an application. A resource ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.