I have a Razor Class Library which contains some razor views, and some content within its wwwroot folder.
When I import the compiled DLL file into a .NET Core web project using Visual Studio (Add Project Reference), all works well.
However, if I attempt to load the DLL dynamically (using reflection), all seems to work apart from being able to access the content within the wwwroot folder (i.e., its not mapped to the _content/AssemblyName/ path).
I'm using the following code to import the assembly dynamically and add it as an application part:
Assembly PrimaryAssembly = Assembly.LoadFrom("bin\\Debug\\net6.0\\RCL.dll");
AssemblyPart assemblypart = new AssemblyPart(PrimaryAssembly);
EmbeddedFileProvider fileProvider = new EmbeddedFileProvider(PrimaryAssembly);
services.AddControllersWithViews().ConfigureApplicationPartManager(apm => apm.ApplicationParts.Add(assemblypart));
services.Configure<MvcRazorRuntimeCompilationOptions>(options => options.FileProviders.Add(fileProvider));
I'm using .NET Core 6.0.
Any Ideas?
Cheers.