I am trying to use AutoFixture.AutoMoq 3.40.0
with Moq 4.2.1510.2205
in an ASP.Net 5.0 project but I'm hitting the problem that;
The dependency moq >= 4.1.1308.2120 could not be resolved.
This is weird because AutoFixture.AutoMoq depends on moq (>= 4.1.1308.2120)
(see https://www.nuget.org/packages/AutoFixture.AutoMoq) so it should work fine with Moq 4.2.x
(shouldn't it?)
I have created a new, empty project and just added the two dependencies to reduce the problem to its core.
Project.json looks like this;
{
"version": "1.0.0-*",
"description": "DependencyTest Console Application",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Moq": "4.2.1510.2205",
"AutoFixture.AutoMoq": "3.40.0"
},
"commands": {
"DependencyTest": "DependencyTest"
},
"frameworks": {
"dnx451": {}
}
}
As soon as I try to build this otherwise empty project I get the above error. If I remove the reference to Moq
in project.json (or point it to a 4.1.x version) then it compiles. Unfortunately, the codebase I'm trying to put this into already makes use of features from Moq 4.2.
Looking in project.lock.json
it looks like the >= dependency on Moq 4.1 is translated into a fixed dependency on 4.1 which would imply that there is a problem with how the dependencies are worked out by dotnet?
I have tried changing the order that the packages are listed in project.json, tried using dnu restore
and tried deleting roaming/nuget/nuget.config
, all to no avail.