How to add moq as a dependency in the dotnet core?

I have the following dependencies in my dotnet core application:

"dependencies": { "xunit": "2.2.0-beta2-build3300", "dotnet-test-xunit": "2.2.0-preview2-build1029", "Moq": "4.0.10827" }, 

And no matter which version of iQ Moq is simply not supported, it says:

 Package Moq 4.0.10827 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Moq 4.0.10827 supports: - net35 (.NETFramework,Version=v3.5) - net40 (.NETFramework,Version=v4.0) - sl4 (Silverlight,Version=v4.0) One or more packages are incompatible with .NETCoreApp,Version=v1.0. 

But I read on this blogpost: Moq on .NET Core , which was possible, I have a nuget plugin in the studio code, so it autocompletes packages, I just can’t find any package when I write moq.netcore Maybe I ask more approach to figuring out whether such a plugin really exists is more than an answer, because right now I can’t see on nuget if the packages are supported on dotnet Core, how do you guys check if it has support? and you only look at packages on Nuget.org ?

thanks

EDIT: Solution project.json:

 { "version": "1.0.0-*", "testRunner": "xunit", "dependencies": { "xunit": "2.2.0-beta2-build3300", "dotnet-test-xunit": "2.2.0-preview2-build1029", "moq": "4.6.38-alpha" }, "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0" } } } } } 
+7
asp.net-core moq nuget
source share
1 answer

I assume that the current stable version in Nuget is 4.5.23, and the code you mentioned should be 4.0.10827, maybe this is causing problems.

As shown in your error, Moq 4.0.10827 is not compatible with netcoreapp1.0 and it only supports up to 4.0. Look here for more details on Moq versions.

I also wrote a Moq blog in the .Net core, which is here . But I am making changes in this everyday life due to new changes.

Edit: According to DenLilleMand:

4.6.38-alpha works, but, for example, 4.5.3 does not work, which complains that Moq 4.5.3 supports net45, and one or more packages are incompatible with .NETCoreApp V1.0.

+7
source share

All Articles