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>

查看:42
本文介绍了ASP.Net Core Web API 构建错误 - MSB4019 未找到导入的项目 Microsoft.DotNet.Props.确认 <Import> 中的路径.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我添加 Sqlite 参考(见下文)并更改了 Microsoftproject.json 中的 .NETCore.App 依赖版本从 1.0.1(正在运行)到 1.1.0(正在破坏构建并出现以下错误).

<块引用>

错误 MSB4019 未找到导入的项目C:Program Filesdotnetsdk1.0.1MicrosoftVisualStudiov14.0DotNetMicrosoft.DotNet.Props".确认声明中的路径是正确,并且该文件存在于磁盘上.Cities.API C:ShivaPluralSightCities.APICities.API.xproj 8

请不要将此标记为与任何一个重复

  1. dotnet --info

    的输出

    [ 2017 年 3 月 15 日更新] 根据 @Leo-MSFT 的要求,这是 dotnet --info

    的输出

    解决方案

    我有一个类似的错误(见这个问题:Swagger-codegen:为 .NET Core 构建 Pet Store 示例时出错)

    对我来说修复是运行 dotnet migrate 更新项目以使用 .csproj 并移动 .xproj>project.json 挡路.

    此处的更多信息:https://docs.microsoft.com/en-us/dotnet/core/migration/#dotnet-migrate

    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).

    Error MSB4019 The imported project "C:Program Filesdotnetsdk1.0.1MicrosoftVisualStudiov14.0DotNetMicrosoft.DotNet.Props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. Cities.API C:ShivaPluralSightCities.APICities.API.xproj 8

    Please don't mark this as duplicate of either

    1. External VS2013 build error "error MSB4019: The imported project was not found" or
    2. External VS2013 build error "error MSB4019: The imported project was not found"

    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.

    Here's my 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%" ]
      }
    }
    

    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.

    Output of 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)

    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.

    More information here: https://docs.microsoft.com/en-us/dotnet/core/migration/#dotnet-migrate

    这篇关于ASP.Net Core Web API 构建错误 - MSB4019 未找到导入的项目 Microsoft.DotNet.Props.确认 &lt;Import&gt; 中的路径.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆