0

I am trying to scan all assemblies in a subfolder of my main project and then add the contained registry to my main registry in order to override default registry entries, where necessary and intercept types for dependency injection.

For this I create the following registry

public PluginRegistryAdder(string pluginPath)
{
    Scan(x =>
    {
        x.AssembliesFromPath(pluginPath);
        x.LookForRegistries();
    });
}

which I plan to add to my main container like this:

 var pluginRegistries = new PluginRegistryAdder(pluginPath);
 Container.Configure(_ => _.IncludeRegistry(pluginRegistries));

The problem I am now facing is that I get this error, when using AssembliesFromPath and I don't know how to fix it:

System.MissingMethodException: Method not found: 'Void StructureMap.Graph.IAssemblyScanner.AssembliesFromPath(System.String)'.

Googling suggests that I should use the namespace StructureMap.Graph, but this did not solve the problem. Here are my using statements, of which only StructureMap is not greyed out (e.g. marked as not redundant) by Visual Studio (I was trying to find the missing reference, but nothing helped):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StructureMap;
using StructureMap.Graph;
using StructureMap.Configuration.DSL;
using StructureMap.Configuration;
using StructureMap.Graph.Scanning;
using StructureMap.Util;

Any suggestions, what I should try?!

UPDATES:

  1. Note that when I comment out just the line with AssembliesFromPath, solution runs just fine, although LookForRegistries is definded in the same class as AssembliesFromPath.
  2. AssembliesFromApplicationBaseDirectory gives me the same problem.
packoman
  • 1,230
  • 1
  • 16
  • 36

1 Answers1

0

This problem seems to have been caused by a version mismatch between my DI project and my main project. After some trying I ended up reinstalling the newest version of StructureMap in both projects and the problem went away.

packoman
  • 1,230
  • 1
  • 16
  • 36