1
votes

I am trying to get a basic .NET Core app up and running. I created an empty Core Web application in Visual Studio 2015. I did not make any changes before trying to build and run. I am getting an error on the package restore. I have one project in the solution. How should I fix this?

error: Version conflict detected for System.Net.Http.

error: Test (>= 1.0.0) -> Microsoft.NETCore.App (>= 1.0.0) -> System.Net.Requests (>= 4.0.11) -> System.Net.Http (>= 4.1.0)

error: Test (>= 1.0.0) -> Microsoft.NETCore.App (>= 1.0.0) -> NETStandard.Library (>= 1.6.0) -> System.Net.Http (>= 4.1.0).

error: Project System.Net.Http is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Project System.Net.Http supports: net451 (.NETFramework,Version=v4.5.1)

error: One or more projects are incompatible with .NETCoreApp,Version=v1.0.

project.json file:

{
  "dependencies": {
    "Microsoft.NETCore.App": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.Extensions.Logging.Console": "1.0.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}
2
Could you please show your project.json - Andrius
Please try changing Microsoft.NETCore.App dependency (3 line in project.json) like that: "Microsoft.NETCore.App": { "version": "1.1.0", "type": "platform" } - Andrius
I updated this and has the same error - katie77
Just to be sure. my nuget is pointing to api.nuget.org/v3/index.json. Is this correct? - katie77

2 Answers

2
votes

The error message suggests that NuGet has found a project named System.Net.Http and is using that instead of the package System.Net.Http.

error: Project System.Net.Http is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0).

If it were an issue with packages, the restore message would say Package instead of Project.

I have one project in the solution.

Check that you don't have a project named System.Net.Http next to your "Test" project, or in any folders configured via the global.json file. The project.json project system will still find the project even if it is not included in your Visual Studio .sln file.

2
votes

Looks like you're mixing .NET Core version 1.0 and 1.1. Also, your dependency specification on Microsoft.NETCore.App is incorrect. Try updating it to:

"Microsoft.NETCore.App": {
    "version": "1.0.1",
    "type": "platform"
}

If you wish to use .NET Core and ASP.NET Core 1.1 (the latest 'Current' version), update your dependencies accordingly:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
        "version": "1.1.0",
        "type": "platform"
    }
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final"
  },

  "frameworks": {
    "netcoreapp1.1": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  // etc..
}