Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

/resource

Embeds a managed resource in an assembly.

/resource:filename[,identifier[,public|private]]

-or-

/res:filename[,identifier[,public|private]]

Arguments

filename
The resource file to embed in the output file. By default, filename is public in the assembly.
identifier[,public|private]
Optional. The logical name for the resource; the name used to load it. The default is the name of the file. Optionally, you can specify whether the resource is public or private in the assembly manifest; for example:
/res:filename.res,myname.res,public.

Remarks

Use /resource to link a resource to an assembly without placing the resource file in the output file.

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). For all other resources, use the GetManifestResource methods in System.Reflection.Assembly class to access the resource at run time.

/res is the short form of /resource.

To set /resource in the Visual Studio integrated development environment

  1. Add a resource file to your project.
  2. Select the file to embed in Solution Explorer.
  3. Select Build Action for the file in the Properties Window.
  4. Set Build Action to Embedded Resource.

To set /resource programmatically

  • See BuildAction Property (Visual Basic and C# ProjectItem Object).

Example

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

vbc /res:rf.resource in.vb

See Also

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

Show:
© 2015 Microsoft