Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 342101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:46:17+00:00 2026-05-12T10:46:17+00:00

Ok, I wrote this question up earlier today but I decided to delete it

  • 0

Ok, I wrote this question up earlier today but I decided to delete it because I thought the question wasn’t worded very well. I decided to wait until I had more time to compose it at home :).
I am just getting started with IOC/DI. I have done some research on which framework to use and decided to give StructureMap a spin. The following is the first tutorial I used:
http://dimecasts.net/Casts/CastDetails/39 by Derik Whittaker.

Anyways, I got everything working like a dream with EVERYTHING is hosted in the same project.
Here is my sample code:

[PluginFamily("SMTest",IsSingleton=true)]
public interface IVehicle
{
     byte TopSpeed {set;get;}
     byte MPG { set; get; }

}

[Pluggable("SMTest")]
public class Car : IVehicle
{
    private byte mTopSpeed;
    private byte mMPG;
    #region IVehicle Members

    byte IVehicle.TopSpeed
    {
        get
        {
            return mTopSpeed;
        }
        set
        {
            mTopSpeed = value;
        }
    }

   public interface IConsumer
  {

    IVehicle Car { get; set; }
  }

     [Pluggable("SMTest")]
public class Consumer : StructureMapBasic.IConsumer
{
    private IVehicle mCar;

    public Consumer(IVehicle lcar)
    {
        Car = lcar;    
    }

    public IVehicle Car { set; get; }


    byte IVehicle.MPG
    {
        get
        {
            return mMPG;
        }
        set
        {
            mMPG = value;
        }
    }

    #endregion
}

So anyways if i create the project above into a command line program and do the following:

var consumer = ObjectFactory.GetInstance<IConsumer>();

It works perfectly. No problems at all. When i create a seperate project in the solution and then change the project above to a DLL. I get the following error:

Test method StructureMapBasic.ConsumerTest.ConsumerConstructorTest 
threw exception:  StructureMap.StructureMapException: StructureMap 
Exception Code:  202 No Default Instance defined for PluginFamily 
StructureMapBasic.IConsumer, StructureMapBasic, Version=1.0.0.0, 
Culture=neutral, PublicKeyToken=null.

At first i thought maybe the StructureMap.Config file didn’t get into the new projects bin folder but that wasn’t the case. It was there. Everythign compiles just fine this problem happens at runtime. I’m sure the solution is very easy but for the life of me i can’t figure out whats going wrong. Any help would be MUCH appreciated.

Thanks,
Ncage

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T10:46:17+00:00Added an answer on May 12, 2026 at 10:46 am

    I took me all friggn day to figure this out. At first i thought i was just being an idiot and i was missing something stupid. Well i was not. I thought it was related to different projects but it was not. I created a new console application that consumed my StructureMapped DLL (If just coined a term 😉 ). Anyways, after trying to spend all day on this problem i FINALLY found a post that described the problem. its a freakn bug in MSTest (my project i was having problems with was created in MSTest). Xunit here i come. Here is a post that describes the issue from the same guy who created the tutorial video:

    http://devlicio.us/blogs/derik_whittaker/archive/2008/07/23/mstest-why-i-hate-you-you-cause-me-too-much-friction.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This relates to another question I asked earlier today. I built SVN 1.6.2 from
I saw this question: Repeating code in JUnit tests earlier today. How do you
This is a follow up to a question I asked earlier today regarding the
OK, I asked this question earlier today How do I write a scope to
Okay this is a revised question from earlier today, I have included code to
Earlier today I asked this question which arose from A- My poor planning and
You may think this question is like this question asked on StackOverflow earlier. But
So I wrote this simple console app to aid in my question asking. What
this is somewhat of an odd question. I wrote a C function. Its 'like'
I wrote a linked list implementation for my java class earlier this year. This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.