Assuming assembly reference 'System.Runtime, Version=4.0.20.0'

asp.net-core-1.0 entity-framework-core visual-studio-2015

Question

I have the following warning in all my code:

Warning in Visual studio 2015 community edition

Here is my project.json:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "build"
    },
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Razor.Tools": {
    "version": "1.0.0-preview2-final",
    "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
    "Microsoft.EntityFrameworkCore": "1.0.1",
    "System.Runtime": "4.1.0"
  },
  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
      "dotnet5.6",
      "portable-net45+win8"
      ]
    }
  },
  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp    deploy-node-libraries", "gulp sass", "gulp min" ]
   }
}

As you see I included "System.Runtime": "4.1.0" like a dependency as suggested in previous versions like a fix, but it doesn't work. My environment is: Windows 7 Pro - Service pack 1 - Core I7, Visual studio 2015 comunity edition - Asp.Net Core Project Template

The project actually compiles but all the lines where I call and class from EntityFramework core are underlined and IISExpress can't serve the page.

1
1
4/16/2017 7:00:38 AM

Accepted Answer

I had the same issue, here is how I fixed mine:

Try to run:

nuget.exe locals all -clear

In the nuget cli to clear your local cache.

Then in the cli, type:

dotnet restore

Then add your runtimes in the project json and get rid of "type": "build" in:

"Microsoft.NETCore.App": {
  "version": "1.0.0",
  "type": "build" <= remove that line
},

I have also set the version to 1.0.1. I have installed the 1.0.0-preview2-003131 of the SDK as well and have set my global.json file accordingly:

"sdk": {
    "version": "1.0.0-preview2-003131"
}

In each project.json of my 3 projects, I have

  "frameworks": {
    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "version": "1.0.1"
        }
      }
    }
  },
  "runtimes": {
    "win10-x64": {}
  }

And my version of "Microsoft.AspNetCore.Server.Kestrel" is "1.0.1", so is "Microsoft.AspNetCore.Mvc" (1.0.1)

If that still does not work, try to reinstall the latest SDK (1.0.0-preview2-003131) and check that you have:

  • Visual Studio 2015 Update 3 .NET Core 1.0.1
  • VS 2015 Tooling Preview 2

More info about the update can be seen here.

Hope this helps.

0
10/3/2016 10:44:59 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow