Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual C#
C# Reference
C# Compiler Options
 /resource (Embed Resource File to O...
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
C# Language Reference 
/resource (Embed Resource File to Output) (C# Compiler Options) 

Embeds the specified resource into the output file.

/resource:filename[,identifier[,accessibility-modifier]]
filename

The .NET Framework resource file you want to embed in the output file.

identifier (optional)

The logical name for the resource; the name used to load the resource. The default is the name of the file name.

accessibility-modifier (optional)

The accessibility of the resource: public or private. The default is public.

Use /linkresource to link a resource to an assembly and not place the resource file in the output file.

By default, resources are public in the assembly when created with the C# compiler. To make the resources private, specify private as the accessibility modifier. No other accessibility other than public or private is allowed.

If filename is a .NET Framework resource file created, for example, by Resgen.exe or in the development environment, it can be accessed with members in the System.Resources namespace (see System.Resources.ResourceManager for more information). For all other resources, use the GetManifestResource* methods in the Assembly class to access the resource at run time.

/res is the short form of /resource.

The order of the resources in the output file is determined from the order specified on the command line.

To set this compiler option in the Visual Studio development environment

  1. Add a resource file to your project.

  2. Select the file you want to embed in Solution Explorer.

  3. Select Build Action for the file in the Properties window.

  4. Set Build Action to Embedded Resource.

For information on how to set this compiler option programmatically, see BuildAction.

Compile in.cs and attach resource file rf.resource:

csc /resource:rf.resource in.cs

Other Resources

C# Compiler Options

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker