无法引用 StructureMap.AutoMocking.dll 以使用 RhinoAutoMocker

Trouble Referencing StructureMap.AutoMocking.dll to use RhinoAutoMocker

我一直渴望尝试 StructureMap 的 RhinoMocks 自动模拟容器,每个:http://docs.structuremap.net/AutoMocker.htm

本文档指出:

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

然而,尽管已经将 RhinoMocks 3.6.1 和结构图版本 3.1.4.143 和 structuremap.automocking 3.1.0.133 引入我的测试项目,但没有对 StructureMap.AutoMocking.dll 的引用(因此它不在我的 /bin 中)因此我无法解析 RhinoAutoMocker。

我从头开始创建了一个新项目并且一切正常,这让我相信我现有的项目设置有些奇怪。删除 structuremap、structuremap.automocking 和 RhinoMocks 并重新添加会产生相同的结果——没有 structuremap.automocking DLL。

还有其他人遇到过这个问题吗?这只是一个 Nuget/VisualStudio 问题吗?

事实证明,VisualStudio 没有根据这个问题在本地复制 DLL:MSBuild doesn't copy references (DLL files) if using project dependencies in solution

将对 StructureMap.AutoMocking 的引用的复制本地 属性 更改为 False,保存,然后将其更改回 True,再次保存解决了我的问题。