Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Name of embedded resource

In C#, the default behaviour of embedded resource name is like this:

<default namespace.><extended namespace.><filename> 

Without changing the default namespace of the project, can I control the name of embedded resource?

like image 559
Kuldip Saini Avatar asked Aug 31 '10 01:08

Kuldip Saini


People also ask

What are embedded resources?

Embedded resource has no predefined structure: it is just a named blob of bytes. So called “. resx” file is a special kind of embedded resource. It is a string -to-object dictionary that maps a name to an object. The object may be a string , an image, an icon, or a blob of bytes.

How do I add embedded resources to Visual Studio?

Open Solution Explorer add files you want to embed. Right click on the files then click on Properties . In Properties window and change Build Action to Embedded Resource . After that you should write the embedded resources to file in order to be able to run it.

What is the use of embedded resource C#?

Embedded files and their Advantages Embedded files are called as Embedded Resources and these files can be accessed at runtime using the Assembly class of the System. Reflection namespace. Any file within the project can be made into an embedded file.

What is manifest resource c#?

A manifest resource is a resource (such as an image file) that is embedded in the assembly at compile time.


1 Answers

The way to do this is quite simple, but you will have to edit the Visual Studio Project (csproj or vbproj) file in a text editor. See this MSDN blog post.

Here is the relevant XML snippet:

<ItemGroup>   <EmbeddedResource Include="bar.resx">       <LogicalName>notfoo.bar.resources</LogicalName>   </EmbeddedResource> </ItemGroup> 
like image 127
Justin Dearing Avatar answered Sep 25 '22 10:09

Justin Dearing