ASPNet Core 2.1 correct way to load precompiled views
ASPNet Core 2.1 correct way to load precompiled views
I am trying to add a plugin like functionality to my application and having hard time making the precompiled views to be found.
So lets say i have a Razor Class Library that compiled to plugin.dll and plugin.views.dll
I am successfully load and add plugin.dll
Assembly PLUGIN_ASSEMBLY = null;
try
PLUGIN_ASSEMBLY = Assembly.LoadFile(PLUGIN.PluginFileName);
Assembly.LoadFile(PLUGIN.PluginViewsFileName);
catch (FileLoadException)
throw;
Then the assembly is added with
MVC_BUILDER.AddApplicationPart(PLUGIN_ASSEMBLY);
Then i add the plugin base path so its normal views would be discovered
MVC_BUILDER.AddRazorOptions(o =>
IFileProvider physicalProvider = new PhysicalFileProvider(PLUGIN.BasePath);
IFileProvider compositeProvider = new CompositeFileProvider(physicalProvider);
o.FileProviders.Add(compositeProvider);
);
All above works fine except that i can only use the physically located views and not the ones from plugin.views.dll
What would be correct approach to add the views.dll and make the views discovered?
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.