This documentation is archived and is not being maintained.


Creates a link to a managed resource.





Required. The resource file to link to the assembly.
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 specify whether the file is public or private in the assembly manifest; for example, /linkres:filename.res,myname.res,public. By default, filename is public in the assembly.


The /linkresource option does not embed the resource file in the output file; use the /resource option to do this.

/linkresource requires one of the /target options other than /target:module.

If filename is a .NET Framework resource 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 (see ResourceManager Class for more information). To access all other resources at run time, use the methods that begin with GetManifestResource in the Assembly Class class .

filename can be any file format. For example, you may want to make a native DLL part of the assembly, so it can be installed into the Global Assembly Cache and accessed from managed code in the assembly.

The short form of /linkresource is /linkres.

Note   The /linkresource option is not available from within the Visual Studio development environment; it is available only when compiling from the command line. It cannot be changed programmatically.


The following code compiles in.vb and links to resource file rf.resource:

vbc /linkresource:rf.resource in.vb

See Also

Visual Basic Compiler Options | /target | /target:module | /resource | Sample Compilation Command Lines