ResourceSet does not load items in subfolders of subfolders

I use regular code to load the assembly and get its resources. It finds all resources that are in top-level subfolders (for example, “component / images”), but if I put resources such as images in subfolders (for example, component / Images / MenuIcons), then none of these resources fall into in I checked the application.g.resources file and they are there. I tried two ways to scan resources:

System.Globalization.CultureInfo culture = Thread.CurrentThread.CurrentCulture; string resourceName = asm.GetName().Name + ".g"; System.Resources.ResourceManager rm = new System.Resources.ResourceManager(resourceName, asm); System.Resources.ResourceSet resourceSet = rm.GetResourceSet(culture, true, true); List<string> resources = new List<string>(); foreach (DictionaryEntry resource in resourceSet) resources.Add((string)resource.Key); rm.ReleaseAllResources(); return resources; 

And:

 foreach (string name in assembly.GetManifestResourceNames()) { using (Stream stream = assembly.GetManifestResourceStream(name)) { using (IResourceReader reader = new ResourceReader(stream)) { foreach (DictionaryEntry entry in reader) { // Add resource here } } } } } 

Both methods give identical results, but none of them include any resources in subfolders of subfolders. Does anyone know how I can get a list of these? They work very well when referencing packages: URIs.

+4
source share
1 answer

Perhaps your resources are not copied to the bin directory on Build? Check the build and copy properties of the output directories of these files.

0
source

All Articles