0

The title is the question really...

I have an embedded Razor Class Library which contains some CSS files, which are a bunch of Bootstrap Themes.

Since Razor Class Libraries compile their entire content into a single file, there is no File System as such, so Directory.GetFiles on the wwwroot/css directory does not work as it would in a normal Website project.

So, does anyone know how to get a list of embedded CSS files in code?

(in case relevant, THIS SO QUESTION is one I asked earlier in the development of this project and shows the code I am using to embed the static files in my RCL)

(Project uses .NET Core 3.0)

Frant
  • 5,382
  • 1
  • 16
  • 22
Jamie Hartnoll
  • 7,231
  • 13
  • 58
  • 97

1 Answers1

0

I found the answer using a combination of these SO answers:

How to get class library assembly reference in .NET Core project?

confused about resources and GetManifestResourceNames()

 System.Reflection.Assembly assembly = System.Reflection.Assembly.GetAssembly(typeof(NameSpaceForMyRCL.Class));
 string[] names = assembly.GetManifestResourceNames();

The code above gets me the complete list of embedded files which I can then filter with Linq

Jamie Hartnoll
  • 7,231
  • 13
  • 58
  • 97