Permalink
Fetching contributors…
Cannot retrieve contributors at this time
81 lines (66 sloc) 3.17 KB
title ms.date ms.prod ms.reviewer ms.suite ms.technology ms.topic dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author translation.priority.ht
/resource (Visual Basic)
2015-07-20
.net
devlang-visual-basic
article
VB
/resource compiler option [Visual Basic]
-resource compiler option [Visual Basic]
/res compiler option [Visual Basic]
res compiler option [Visual Basic]
-res compiler option [Visual Basic]
resource compiler option [Visual Basic]
eee2f227-91f2-4f2b-a9d6-1c51c5320858
19
dotnet-bot
dotnetcontent
cs-cz
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
pl-pl
pt-br
ru-ru
tr-tr
zh-cn
zh-tw

/resource (Visual Basic)

Embeds a managed resource in an assembly.

Syntax

/resource:filename[,identifier[,public|private]]  
' -or-  
/res:filename[,identifier[,public|private]]  

Arguments

Term Definition
filename Required. The name of the resource file to embed in the output file. By default, filename is public in the assembly. Enclose the file name in quotation marks (" ") if it contains a space.
identifier 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, as with the following: /res:``filename.res,myname.res,public

Remarks

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

If filename is a [!INCLUDEdnprdnshort] resource file created, for example, by the Resgen.exe (Resource File Generator) or in the development environment, it can be accessed with members in the xref:System.Resources namespace (see xref:System.Resources.ResourceManager for more information). To access all other resources at run time, use one of the following methods: xref:System.Reflection.Assembly.GetManifestResourceInfo%2A, xref:System.Reflection.Assembly.GetManifestResourceNames%2A, or xref:System.Reflection.Assembly.GetManifestResourceStream%2A.

The short form of /resource is /res.

For information about how to set /resource in the Visual Studio IDE, see Managing Application Resources (.NET).

Example

The following code compiles In.vb and attaches resource file Rf.resource.

vbc /res:rf.resource in.vb  

See Also

Visual Basic Command-Line Compiler
/win32resource
/linkresource (Visual Basic)
/target (Visual Basic)
Sample Compilation Command Lines