1

我創造了在VS2015 asp.net核心一個空的Web項目,但有建立自己的錯誤:如何在vs 2015中重新定位.net核心應用程序的框架?

Error MSB3644 The reference assemblies for framework ".NETFramework,Version=v4.5.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. G:\projects\temp\WebApplication4\src\WebApplication4\WebApplication4.xproj C:\Program Files (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後,錯誤消失。但仍想重新定位到更新的版本。

回答

1
"frameworks": { 
    "net461": { }, 
    "netcoreapp1.0": { 
     "dependencies": { 
     "Microsoft.NETCore.App": { 
      "type": "platform", 
      "version": "1.0.0" 
     } 
     } 
    } 
    } 
+0

我得到一個錯誤:「依賴Microsoft.NETCore.App 1.0.1不支持框架.NETFramework,版本= v4.6.1。」 - 我懷疑無法切換到4.6.1。 – Leon

+0

那麼你有答案,那麼它不能支持4.6.1。但你的問題是如何做到這一點,那就是你如何做到這一點。 – CodingYoshi

+0

這不提供問題的答案。要批評或要求作者澄清,請在其帖子下方留言。 - [來自評論](/ review/low-quality-posts/14628088) – Joseph