Share via


/linkresource (Visual Basic) 

Creates a link to a managed resource.

/linkresource:filename[,identifier[,public|private]]
' -or-
/linkres:filename[,identifier[,public|private]]

Arguments

  • filename
    Required. The resource file to link to the assembly. If the file name contains a space, enclose the name in quotation marks (" ").
  • identifier
    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.

Remarks

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

The /linkresource option 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 for more information.) To access all other resources at run time, use the methods that begin with GetManifestResource in the Assembly class.

The file name 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.

Example

The following code compiles In.vb and links to resource file Rf.resource.

vbc /linkresource:rf.resource in.vb

See Also

Reference

/target (Visual Basic)
/resource (Visual Basic)
Sample Compilation Command Lines

Other Resources

Visual Basic Compiler