Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core 1.0 Mocking

I followed this ASP.NET Core 1.0: hints to get started tutorial and others trying to get some mocking working in my ASP.NET Core MVC project. But I only get this:

 Package moq.netcore 4.4.0-beta8 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package moq.netcore 4.4.0-beta8 supports:
  - dotnet (.NETPlatform,Version=v5.0)
  - net35 (.NETFramework,Version=v3.5)
  - net40 (.NETFramework,Version=v4.0)
  - sl5 (Silverlight,Version=v5.0)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.

Is there any solution so far?

My project.json:

 {
  "version": "1.0.0-*",
  "testRunner": "xunit",
  "dependencies": {
    "xunit": "2.2.0-beta2-build3300",
    "APP.Portal": "1.0.0-*",
    "dotnet-test-xunit": "2.2.0-preview2-build1029",
    "moq.netcore": "4.4.0-beta8"
  },
  "frameworks": {
    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.0.0"
        }
      }
    }
  }
}

My NuGet.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <packageSources>
        <add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
        <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
    </packageSources>
</configuration>
like image 489
Anja Hirschmüller Avatar asked Jul 08 '16 08:07

Anja Hirschmüller


1 Answers

You could try adding an import for a supported framework.

Something like:

"frameworks": {
"netcoreapp1.0": {
  "imports": [
    "dotnet5.6",
    "dnxcore50",
    "portable-net45+win8"
  ],
  "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.0"
    }
  }
}
}

EDIT: I found this post useful for understanding frameworks and imports in .net core - https://blogs.msdn.microsoft.com/cesardelatorre/2016/06/28/running-net-core-apps-on-multiple-frameworks-and-what-the-target-framework-monikers-tfms-are-about/

like image 145
David Kirkpatrick Avatar answered Nov 13 '22 22:11

David Kirkpatrick