Partager via


/ASSEMBLYRESOURCE (Embed a Managed Resource)

 

The latest version of this topic can be found at -ASSEMBLYRESOURCE (Embed a Managed Resource).

ASSEMBLYRESOURCE:filename[,[name][,PRIVATE]]

  
## Parameters  
 *filename*  
 The managed resource you want to embed in this assembly.  
  
 *name*  
 Optional. The logical name for the resource; the name used to load the resource. The default is the name of the file.  
  
 Optionally, you can specify if the file should be private in the assembly manifest. By default, *name* is public in the assembly.  
  
## Remarks  
 Use the /ASSEMBLYRESOURCE option to embed a resource in an assembly.  
  
 Resources are public in the assembly when created with the linker. The linker does not allow you to rename the resource in the assembly.  
  
 If *filename* is a .NET Framework resource (.resources) file created, for example, by the [Resource File Generator (Resgen.exe)](../Topic/Resgen.exe%20\(Resource%20File%20Generator\).md) or in the development environment, it can be accessed with members in the **System.Resources** namespace (see [System.Resources.ResourceManager](https://msdn.microsoft.com/en-us/library/system.resources.resourcemanager.aspx) for more information). For all other resources, use the **GetManifestResource**\* methods in **System.Reflection.Assembly** class to access the resource at run time.  
  
 Other linker options that affect assembly generation are:  
  
-  [/ASSEMBLYDEBUG](../Topic/-ASSEMBLYDEBUG%20\(Add%20DebuggableAttribute\).md)  
  
-  [/ASSEMBLYLINKRESOURCE](../Topic/-ASSEMBLYLINKRESOURCE%20\(Link%20to%20.NET%20Framework%20Resource\).md)  
  
-  [/ASSEMBLYMODULE](../Topic/-ASSEMBLYMODULE%20\(Add%20a%20MSIL%20Module%20to%20the%20Assembly\).md)  
  
-  [/DELAYSIGN](../Topic/-DELAYSIGN%20\(Partially%20Sign%20an%20Assembly\).md)  
  
-  [/KEYFILE](../Topic/-KEYFILE%20\(Specify%20Key%20or%20Key%20Pair%20to%20Sign%20an%20Assembly\).md)  
  
-  [/KEYCONTAINER](../Topic/-KEYCONTAINER%20\(Specify%20a%20Key%20Container%20to%20Sign%20an%20Assembly\).md)  
  
-  [/NOASSEMBLY](../Topic/-NOASSEMBLY%20\(Create%20a%20MSIL%20Module\).md)  
  
### To set this linker option in the Visual Studio development environment  
  
1.  Open the project's **Property Pages** dialog box. For details, see [Setting Visual C++ Project Properties](../Topic/Working%20with%20Project%20Properties.md).  
  
2.  Click the **Linker** folder.  
  
3.  Click the **Input** property page.  
  
4.  Modify the **Embed Managed Resource File** property.  
  
### To set this linker option programmatically  
  
1.  See [EmbedManagedResourceFile](assetId:///P:Microsoft.VisualStudio.VCProjectEngine.VCLinkerTool.EmbedManagedResourceFile?qualifyHint=False&autoUpgrade=True).  
  
## See Also  
 [Setting Linker Options](../Topic/Setting%20Linker%20Options.md)   
 [Linker Options](../Topic/Linker%20Options.md)