Search code examples
c#structuremapstructuremap3

Trouble Referencing StructureMap.AutoMocking.dll to use RhinoAutoMocker


I've been dying to try out StructureMap's auto mocking container for RhinoMocks per: http://docs.structuremap.net/AutoMocker.htm

This documentation states:

Out of the box, StructureMap includes the RhinoAutoMocker for RhinoMocks and MoqAutoMocker for Moq. The Auto Mocking support is in the StructureMap.AutoMocking.dll.

However, despite having pulled in RhinoMocks 3.6.1 and structuremap version 3.1.4.143, and structuremap.automocking 3.1.0.133 into my testing project, there is no reference to StructureMap.AutoMocking.dll (and hence it isn't in my /bin) and hence I can't resolve RhinoAutoMocker.

I created a new project from scratch and everything works fine, which leads me to believe there is something strange about my existing project setup. Removing structuremap, structuremap.automocking, and RhinoMocks and re-adding yields the same result -- no structuremap.automocking DLL.

Has anyone else had this problem? Is this just a Nuget/VisualStudio issue?


Solution

  • It turns out that VisualStudio wasn't copying the DLL locally per this issue: MSBuild doesn't copy references (DLL files) if using project dependencies in solution

    Changing the Copy Local property of the reference to StructureMap.AutoMocking to False, saving, then changing it back to True, and saving again solved my problem.