StructureMap Pluggable type or namespace could not be found

726 views Asked by At

I am using Visual Studio 2013 in my project (Asp.net 4.5.1). I used NuGet to add StructureMap on my project.

The Structure of my Solution is:

  1. MyProjectWeb (Created first)
  2. MyProjectCore (add second to Solution)
  3. MyProjectWebTest (added third to Solution)
  4. MyProjectCoreTest (added forth to Solution)

Then, I just added StructureMap, created Database folder in MyProjectCore andbelow the DataBase Folder create Impt.

Also, I added the following classes (in code example the classes appear to be in the same file but in reality they are in separate files)

using System.Collections.Generic;
using System.Ling;
using System.Data.Lina;
using StructureMap;

namespace MyProject.MyProject.DataAccess.Impl
{
    [Pluggable("Default")]
    public class MyClass : IMyClass
    {
    // Code Goes Here
    }
}

namespace MyProject.MyProject.Core.DataAccess
{
    [PluginFamily("Default")]
    public interface IMyClass
    {
        // Code goes here
    }
}

I get the dreaded type or namespace cannot be found for both Pluggable and PluginFamily.

What am I missing here?

Note: Have done tons of research on this and can not seem to find a clear solution. For Clearity this is a webapp project I am trying to recreate and old webapp project to get and understanding of the underlying architecture so I can migrate to an MVC platform. any Help will be appreciated thanks in advance Kevin

1

There are 1 answers

2
nik0lai On

Have you ensured that the project is setup to scan the assembly for attributes?

public class ScanningRegistry : Registry { public ScanningRegistry() { Scan(x => { x.Assembly("MyProject.MyProject.Core.DataAccess"); }); } }

Failing that, is there any particular reason you're using attributes over say a Registry DSL ?