ASP.Net Core Web API生成错误-MSB4019找不到导入的项目Microsoft.DotNet.Props.确认< Import>中的路径是否正确. [英] ASP.Net Core Web API Build Error - MSB4019 The imported project Microsoft.DotNet.Props was not found. Confirm that the path in the <Import>
问题描述
在添加 Sqlite参考(参见下文)并更改了Microsoft.NETCore.App
依赖关系之后,我在 ASP.Net Core Web API项目中遇到以下错误project.json
中的版本从1.0.1
(正在工作)到1.1.0
(正在破坏构建,并出现以下错误).
I am getting the following error in my ASP.Net Core Web API Project, after I added Sqlite Reference (see below) and also changed the Microsoft.NETCore.App
dependency version in project.json
from 1.0.1
(which was working) to 1.1.0
(which is breaking the build with the following error).
错误MSB4019 找不到导入的项目"C:\ Program Files \ dotnet \ sdk \ 1.0.1 \ Microsoft \ VisualStudio \ v14.0 \ DotNet \ Microsoft.DotNet.Props". 确认声明中的路径为 正确,并且文件存在于磁盘上. Cities.API C:\ Shiva \ PluralSight \ Cities.API \ Cities.API.xproj 8
Error MSB4019 The imported project "C:\Program Files\dotnet\sdk\1.0.1\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. Cities.API C:\Shiva\PluralSight\Cities.API\Cities.API.xproj 8
请不要将此标记为任何一个
Please don't mark this as duplicate of either
- External VS2013 build error "error MSB4019: The imported project was not found" or
- External VS2013 build error "error MSB4019: The imported project was not found"
我查看了这2个,它们适用于Visual Studio 2013,而不适用于具有不同项目和配置文件结构的.Net Core版本.
I looked at these 2 and they apply to Visual Studio 2013 and not the .Net Core version, which has a different project and config file structure.
这是我的projects.json
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.1.0",
"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",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Mvc.Formatters.Xml": "1.0.1",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"NLog.Extensions.Logging": "1.0.0-rtm-alpha5",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.EntityFrameworkCore.Sqlite": "1.1.1",
"Microsoft.EntityFrameworkCore.Sqlite.Design": "1.1.1",
"Microsoft.EntityFrameworkCore.Tools": "1.1.0",
"AutoMapper": "5.2.0",
"Microsoft.AspNetCore.ResponseCompression": "1.0.0"
},
"tools": {
"Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
"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%" ]
}
}
,这是当我对Microsoft.NETCore.App
依赖项使用新的更新的1.1.0
进行构建时的错误消息.注意:1.1.0
确实在我执行开头"
时出现在智能感知下拉列表中,这意味着它存在于我的计算机上.
and here's the error message when I do a build with the new updated 1.1.0
for the Microsoft.NETCore.App
dependency. NOTE: the 1.1.0
does show up in the intellisense dropdown when I did the beginning "
which means that it is present on my machine.
[更新2017年3月15日]根据@ Leo-MSFT的请求,以下是dotnet --info
[ Update 15.Mar.2017] Per @Leo-MSFT's request, here's the output of dotnet --info
推荐答案
I had a similar error (see this question: Swagger-codegen: error building Pet Store example for .NET Core)
对我来说,解决方法是运行dotnet migrate
,该更新将项目更新为使用.csproj
并将.xproj
和project.json
移开.
The fix for me was to run dotnet migrate
which updates the project to use a .csproj
and moves the .xproj
and project.json
out of the way.
此处的更多信息: https://docs. microsoft.com/en-us/dotnet/core/migration/#dotnet-migrate
这篇关于ASP.Net Core Web API生成错误-MSB4019找不到导入的项目Microsoft.DotNet.Props.确认< Import>中的路径是否正确.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!