假设程序集引用&System; Run.Runtime,Version = 4.0.20.0'

时间:2016-09-28 19:42:49

标签: visual-studio-2015 entity-framework-core asp.net-core-1.0

我的所有代码中都有以下警告:

Warning in Visual studio 2015 community edition

这是我的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" ]
   }
}

如你所见,我包括了#34; System.Runtime":" 4.1.0"像之前版本中建议的依赖项一样,例如修复,但它不起作用。 我的环境是:Windows 7 Pro - Service Pack 1 - Core I7,Visual Studio 2015社区版 - Asp.Net核心项目模板

项目实际编译但是我调用的所有行和EntityFramework核心的类都加下划线,IISExpress无法为页面提供服务。

1 个答案:

答案 0 :(得分:0)

我有同样的问题,这是我如何修理我的:

尝试运行:

nuget.exe locals all -clear

在nuget cli中清除本地缓存。

然后在cli中输入:

dotnet restore

然后在项目json中添加运行时并删除"type": "build" 在:

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

我还将版本设置为1.0.1。 我也安装了SDK的1.0.0-preview2-003131并相应地设置了我的global.json文件:

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

在我的3个项目的每个project.json中,我有

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

我的版本&#34; Microsoft.AspNetCore.Server.Kestrel&#34;是&#34; 1.0.1&#34;,&#34; Microsoft.AspNetCore.Mvc&#34; (1.0.1)

如果仍然无效,请尝试重新安装latest SDK(1.0.0-preview2-003131)并检查您是否有:

  • Visual Studio 2015 Update 3 .NET Core 1.0.1
  • VS 2015工具预览2

有关此更新的更多信息,请参阅here

希望这有帮助。