如何在Visual Studio 2015中为.NET Core应用程序重新定位框架?

问题描述 投票:1回答:1

我在Visual Studio 2015中使用ASP.NET Core创建了一个空的Web项目,但出现了构建错误:

错误MSB3644框架的参考程序集“ .NETFramework,版本= v4.5.1”未找到。为了解决这个问题,为此框架版本安装SDK或Targeting Pack 或将您的应用程序重新定位到您所针对的框架版本安装了SDK或Targeting Pack]]。请注意,程序集将从全局程序集缓存(GAC)中解析,并将用于参考装配体的位置。因此,您的组装可能不会正确针对您的框架打算。 G:\ projects \ temp \ WebApplication4 \ src \ WebApplication4 \ WebApplication4.xproj C:\ Program档案(x86)\ MSBuild \ 14.0 \ bin \ Microsoft.Common.CurrentVersion.targets 1098

文件project.json:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.1",
      "type": "platform"
    },
    "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%" ]
  }
}

我已安装.NET 4.6和4.6.1 SDK。如何将框架重新定位到4.6.1?

重新安装4.5.1 SDK后,错误消失了。但是我仍然想重新定位到较新的版本。

[我在Visual Studio 2015中使用ASP.NET Core创建了一个空的Web项目,但出现了构建错误:错误MSB3644框架“ .NETFramework,Version = v4.5.1”的参考程序集不是...

c# visual-studio-2015 asp.net-core .net-framework-version
1个回答
1
投票
"frameworks": {
    "net461": { },
    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.0.0"
        }
      }
    }
  }
© www.soinside.com 2019 - 2024. All rights reserved.