我刚刚将一个asp.net核心项目从1.0.1迁移到1.1.0,当运行dotnet run
或dotnet restore
时,我收到以下消息
C:\Users\you\Desktop\API\src\API\API.xproj(7,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.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%" ]
}
}
答案 0 :(得分:4)
问题出在我的解决方案的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
}
}
答案 1 :(得分:0)
您需要从Microsoft网站下载.NET Core 1.1 SDK - Installer。如果您也可以只下载运行时。以下是相同的网址。
https://www.microsoft.com/net/download/core
请参阅下面的图片了解更多详情。
此致 Sachin Pawar