Edit

Share via


/ASSEMBLYRESOURCE (Embed a managed resource)

Embeds a managed resource in an assembly.

Syntax

/ASSEMBLYRESOURCE:filename[,[name][,PRIVATE]]

Arguments

filename
The managed resource you want to embed in this assembly.

name
Optional. The logical name for the resource; the name used to load the resource. The default is the name of the file.

Optionally, you can use PRIVATE to specify if the file should be private in the assembly manifest. By default, name is public in the assembly.

Remarks

Use the /ASSEMBLYRESOURCE linker option to embed a resource in an assembly.

Resources are public in the assembly when created with the linker. The linker doesn't allow you to rename the resource in the assembly.

If filename is a .NET Framework resource (.resources) file created, for example, by the Resource file generator (Resgen.exe) or in the development environment, it can be accessed with members in the System.Resources namespace. For more information, see System.Resources.ResourceManager. For all other resources, use the GetManifestResource* methods in the System.Reflection.Assembly class to access the resource at run time.

Other linker options that affect assembly generation are:

To set this linker option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Set C++ compiler and build properties in Visual Studio.

  2. Select the Configuration Properties > Linker > Input property page.

  3. Modify the Embed Managed Resource File property.

To set this linker option programmatically

  1. See EmbedManagedResourceFile.

See also

MSVC linker reference
MSVC linker options