Today I was putting together a test app for a few presentations I am doing in the coming weeks (announcements on these coming soon). While doing this I kept getting a 101 exception when trying to build an object via StructureMap's ObjectFactory (error information here).
Error message
Assembly {AssemblyNamehere} referenced by an <Assembly> node in StructureMap.config cannot be loaded into the current AppDomain
What did not make sense is that the test project had reference to the assembly that it was complaining about. It turns out that I was not actually using the assembly so it did NOT copy the assembly to the bin directory during compile time. Which I guess makes sense.
So, after pondering what to do, I simply created a 'hack' class that created an instance of an object out of the missing assembly. Now it copied the .dll to the bin directly like I thought it would. I can here you now, why create the 'hack' class. Well, simple, I was not using the assembly directly, but using it via IoC with StructureMap.
So, if you ever get the 101 exception from StructureMap, make sure the assembly is actually being copied to your output (bin) folder like you thought.
Till next time,