I'm trying to build a plugin system for ASP.NET Core application. I have a folder inside the app called 'Plugins'.
In general, a plugin looks like a folder containing two files: Plugin.dll and Plugin.Views.dll The app scans this folder and loads these assemblies
foreach (var ext in extensionManager.Extensions)
{
mvcBuilder.AddApplicationPart(ext.Assembly);
if (ext.ViewsAssembly != null)
{
mvcBuilder.AddApplicationPart(ext.ViewsAssembly);
}
}
If these plugins have ViewComponents with the same name I get an error. Model from Plugin1 may be passed into Plugin2's Razor View.
The model item passed into the ViewDataDictionary is of type 'Plugin1.Models.MyModel',
but this ViewDataDictionary instance requires a model item of type 'Plugin2.Models.MyModel'
How can I resolve this conflict?