Enumerating .NET assembly resources at runtime
Posted
by Alex_P
on Stack Overflow
See other posts from Stack Overflow
or by Alex_P
Published on 2010-03-25T16:34:12Z
Indexed on
2010/03/25
19:53 UTC
Read the original article
Hit count: 611
I have a resource assembly with image files in it that are built using Resource or Content build action. This makes these files accessible using the Uris. However I cannot find the way to enumerate such resources.
If I set the build action to Embedded Resource it becomes possible to enumerate the files with the following code:
string[] resources = Assembly.GetExecutingAssembly().GetManifestResourceNames();
but it in turn makes these files inaccessible using Uris.
The question is - how to enumerate resources that are compiled with either Resource or Content build action?
NOTE: As Thomas Levesque pointed out it is possible to enumerate such resources by leveraging the AssemblyAssociatedContentFileAttribute, but it seems to only work for WPF Application assemblies and not for class library ones. So the question is still open.
© Stack Overflow or respective owner