/resource
This page is specific to:.NET Framework Version:1.12.03.03.54.0
Visual Basic Compiler Options
/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

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View