0

i am developing plugin from this reference link https://github.com/natemcmaster/DotNetCorePlugins

below code work fine earlier but suddenly it stop working here is my starup.cs code

foreach (var pluginDir in Directory.GetDirectories("D:\\Software\\TM.Plugin\\TestPlugin\\Build"))
            {
                var dirName = Path.GetFileName(pluginDir);
                var pluginFile = Path.Combine(pluginDir, dirName + ".dll");
                var loader = PluginLoader.CreateFromAssemblyFile(pluginFile,
                    // this ensures that the plugin resolves to the same version of DependencyInjection
                    // and ASP.NET Core that the current app uses
                    sharedTypes: new[]
                    {
                        typeof(IApplicationBuilder),                        
                        typeof(IWebPlugin),
                        typeof(IServiceCollection),
                    });//upto here code working fine
                foreach (var type in loader.LoadDefaultAssembly()
                    .GetTypes()
                    .Where(t => typeof(IWebPlugin).IsAssignableFrom(t) && !t.IsAbstract))//here it will throw error
                {
                    var plugin = (IWebPlugin)Activator.CreateInstance(type);                                        
                    _plugins.Add(plugin);
                }
            }

gbbosmiya
  • 483
  • 6
  • 19
  • What is the error, can you share the error message? – Karney. Mar 11 '21 at 06:47
  • @Karney. error "System.Reflection.ReflectionTypeLoadException: 'Unable to load one or more of the requested types. Method 'ConfigureServices' in type 'TM.Plugin.MTMT.MTMT' from assembly 'TM.Plugin.MTMT, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.'" – gbbosmiya Mar 11 '21 at 10:51
  • Removing obj and bin folder and rebuild solution again will resolve my problem reference https://stackoverflow.com/questions/1091853/error-message-unable-to-load-one-or-more-of-the-requested-types-retrieve-the-l – gbbosmiya Mar 11 '21 at 12:02

0 Answers0