7

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>
7
  • I have this working fine, can you post your package.json? Commented Jul 8, 2016 at 8:57
  • '{ "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" } } } } } ' This is my project.json Commented Jul 8, 2016 at 9:01
  • And: NuGet.config '<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <add key="AspNetVNext" value="myget.org/F/aspnetcidev/api/v3/index.json" /> <add key="NuGet" value="api.nuget.org/v3/index.json" /> </packageSources> </configuration>' Commented Jul 8, 2016 at 9:04
  • Can you edit your question and add it please, not readable via the comments section :) Commented Jul 8, 2016 at 9:13
  • Compared with mine I am using the package, "Moq": "4.6.25-alpha" but this also requires "system.diagnostics.tracesource": "4.0.0". I will try updating my solution. Just noticed you are using a different feed too. I don't use myget as that caused me problems and compatibility issues. Commented Jul 8, 2016 at 9:46

1 Answer 1

7

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/

Sign up to request clarification or add additional context in comments.

3 Comments

But is this import cheating like it feels?
@AnjaHirschmüller yes does feel like cheating I would suggest attempting to resolve the reference via the source I suggested. This is so that you don't need to add the imports. Have a look at github.com/OnamChilwan/AspCore-1.0.
I believe these imports only reference earlier versions of .net core. More Info So I would say no, it's not cheating unless you're referencing the old .Net frameworks. This just allows you to to run dependencies that haven't been updated yet. I am quite new to this though, so I could be completely off the mark.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.