The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.


Embeds a managed resource in an assembly.





The resource file to embed in the output file. By default, filename is public in the assembly.
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:


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).


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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft