.Net Core 1.1.0 Visual Studio 工具

.Net Core 1.1.0 Visual Studio Tooling

我刚刚将一个 asp.net 核心项目从 1.0.1 迁移到 1.1.0,当 运行 dotnet rundotnet restore 我收到以下消息

C:\Users\you\Desktop\API\src\API\API.xproj(7,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk.0.0-preview4-004110\Extensions\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

我已经安装了所有的 SDK 和运行时,但仍然无法在 visual studio 中创建 .Net Core 1.1.0 项目,也无法在控制台中恢复我的包。

project.json如下,按说迁移是对的,还是想不通

{
  "version": "1.0.0-*",
  "dependencies": {
       "Microsoft.NETCore.App": {
      "version": "1.1.0",
      "type": "platform"
    },
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Routing": "1.0.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "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",
    "Business.Handlers": "1.0.0-*",
    "Business.Connectors": "1.0.0-*",
    "Common": "1.0.0-*",
    "DataAccessLayer": "1.0.0-*"
  },

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

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

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

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

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

问题出在我解决方案 属性 的 global.json 中,我将其更改为 1.0.0-preview2-1-003177 并且有效。

{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-preview2-1-003177" //Previously 1.0.0-preview2-003131
  }
}

您需要从微软网站下载.NET Core 1.1 SDK - Installer。如果您也只能下载运行时。下面是相同的url。

https://www.microsoft.com/net/download/core

详情请见下图。

.net core 1.1.0

此致, 萨钦·帕瓦尔