-resource (C# Compiler Options)
Embeds the specified resource into the output file.
The .NET Framework resource file that you want to embed in the output file.
The logical name for the resource; the name that is used to load the resource. The default is the name of the file name.
The accessibility of the resource: public or private. The default is public.
Use -linkresource to link a resource to an assembly and not add the resource file to the output file.
By default, resources are public in the assembly when they are created by using the C# compiler. To make the resources private, specify
private as the accessibility modifier. No other accessibility other than
private is allowed.
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. For more information, see System.Resources.ResourceManager. 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
Add a resource file to your project.
Select the file that you want to embed in Solution Explorer.
Select Build Action for the file in the Properties window.
Set Build Action to Embedded Resource.
For information about how to set this compiler option programmatically, see BuildAction.
in.cs and attach resource file
csc -resource:rf.resource in.cs
Send feedback about: