Visual Studio Resource Naming Rules
What are Visual Studio's resource naming rules?
When you have an item whose BuildAction="EmbeddedResource" in your Visual Studio project, that item gets embedded into your final assembly (either the main assembly or one of the satellite assemblies). When it gets embedded into the assembly, it is given a manifest resource name. This is the name by which the resource is accessed from your code. Here are the rules that Visual Studio uses for computing the manifest resource name. Well, okay, these aren't really the rules written out in English. Instead, I thought it would be more useful to just give several examples, and let you derive the rules from this.
Assuming a project whose AssemblyName is "MyApp" and RootNamespace is "RN" ...
Source | Assembly (under bin\debug) | Manifest Resource Name |
---|---|---|
Form1.resx (under Form1.cs with class N1.Form1Class) | MyApp.exe | N1.Form1Class.resources |
Normal.resx | MyApp.exe | RN.Normal.resources |
Embedded.bmp | MyApp.exe | RN.Embedded.bmp |
Folder1\Folder2\Form1.resx (under Form1.cs with class N1.N2.Form1Class) | MyApp.exe | N1.N2.Form1Class.resources |
Folder1\Folder2\Normal.resx | MyApp.exe | RN.Folder1.Folder2.Normal.resources |
Folder1\Folder2\Embedded.bmp | MyApp.exe | RN.Folder1.Folder2.Embedded.bmp |
Form1.de.resx (under Form1.cs with class N1.Form1Class) | de\MyApp.resources.dll | N1.Form1Class.de.resources |
Cultured.de.resx | de\MyApp.resources.dll | RN.Cultured.de.resources |
EmbeddedCultured.de.bmp | de\MyApp.resources.dll | RN.EmbeddedCultured.bmp |
Folder1\Folder2\Form1.de.resx (under Form1.cs with class N1.N2.Form1Class) | de\MyApp.resources.dll | N1.N2.Form1Class.de.resources |
Folder1\Folder2\Cultured.de.resx | de\MyApp.resources.dll | RN.Folder1.Folder2.Cultured.de.resources |
Folder1\Folder2\EmbeddedCultured.de.bmp | de\MyApp.resources.dll | RN.Folder1.Folder2.EmbeddedCultured.bmp |
(Source: http://channel9.msdn.com/wiki/default.aspx/MSBuild.VisualStudioResourceNamingRules)