Control going to ConfigureServices method of custom plugin even when plugin is not installed in Nop 4.10.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
My code is:

public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
        {
            var _pluginFinder = EngineContext.Current.Resolve<IPluginFinder>();
            //get plugins
            var plugin = _pluginFinder.GetPluginDescriptorBySystemName("plugin.customName", 0);
            if (plugin != null && plugin.Installed)
            {
                //Do something
            }
        }

Even when plugin is uninstalled Control going to ConfigureServices method of custom plugin but I want it to go only when plugin is installed. Working fine in Nop 4.0 but in Nop 4.1 during creating instances in Nop.Engine.cs where plugin is installed condition is commented which giving issue. What to do?
5 years ago
Hello Vishal


var _pluginFinder = EngineContext.Current.Resolve<IPluginFinder>();

PluginDescriptor currentPlugin= _pluginFinder.GetPluginDescriptorBySystemName("plugin.customName");

if (currentPlugin != null && currentPlugin.Installed)
{
//Do something
}

-----------------------------------
use this
PluginDescriptor currentPlugin= _pluginFinder.GetPluginDescriptorBySystemName("plugin.customName");

not this
var plugin = _pluginFinder.GetPluginDescriptorBySystemName("plugin.customName", 0);

It can be help for you.

Thank you
Sagar Kayasth
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.