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
- Add a resource file to your project.
- Select the file to embed in Solution Explorer.
- Select Build Action for the file in the Properties Window.
- 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
vbc /res:rf.resource in.vb