asp.net 核心恢复失败 - 多个项目 (ubuntu-16.04-x64)

asp.net core restore fails - multiple projects (ubuntu-16.04-x64)

我正在尝试在 Ubuntu 16.04 上部署 .NET Core 应用程序。该项目包含对其他项目的引用(即不通过 nuget),该应用程序在本地运行良好(win10-x64)但是在服务器上键入 dotnet restore 时我收到以下日志:

XXXXXX@ip-XXX-XXX-XXX-X:/home/XXXXXX$ dotnet restore
    log  : Restoring packages for /home/XXXXXX/project.json...
    error: Unable to resolve 'XXXXXX.Configuration (>= 1.0.0)' for '.NETCoreApp,Version=v1.0'.
    error: Unable to resolve 'XXXXXX.DataModels (>= 1.0.0)' for '.NETCoreApp,Version=v1.0'.
    error: Unable to resolve 'XXXXXX.DAL (>= 1.0.0)' for '.NETCoreApp,Version=v1.0'.
    error: Unable to resolve 'XXXXXX.Application (>= 1.0.0-0)' for '.NETCoreApp,Version=v1.0'.
    error: Unable to resolve 'XXXXXX.BLL (>= 1.0.0)' for '.NETCoreApp,Version=v1.0'.
    log  : Lock file has not changed. Skipping lock file write. Path: /home/XXXXXX/project.lock.json
    log  : /home/XXXXXX/project.json
    log  : Restore failed in 4546ms.

log  : Lock file has not changed. Skipping lock file write. Path: 

我已经查看了相关问题 , here and here 中的建议,但是 none 的解决方案似乎可以解决我的问题。

鉴于核心框架的变化速度,我将指定正在使用的版本和项目的 project.json 文件:

XXXXXX.Configuration(.NET Core Class 库) project.json:

{
  "version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.6.1"
  },

  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  }
}

XXXXXX.DataModels(.NET Core Class 库) project.json

{
  "version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.6.1",
    "XXXXXX.Application": "1.0.0-0"
  },

  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  }
}

XXXXXX.DAL(.NET Core Class 库) project.json

{
  "version": "1.0.0-*",

  "dependencies": {
    "MySql.Data": "7.0.6-IR31",
    "NETStandard.Library": "1.6.1",
    "XXXXXX.Application": "1.0.0-0",
    "XXXXXX.Configuration": "1.0.0-*",
    "XXXXXX.DataModels": "1.0.0-*"
  },

  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  }
}

XXXXXX.Application(.NET Core Class 库) poject.json

{
  "version": "1.0.0-0",

  "dependencies": {
    "Microsoft.AspNetCore.Mvc.Abstractions": "1.1.0",
    "Microsoft.AspNetCore.Mvc.Core": "1.1.0",
    "Microsoft.AspNetCore.Mvc.DataAnnotations": "1.1.0",
    "Microsoft.AspNetCore.Mvc.ViewFeatures": "1.1.0",
    "MySql.Data": "7.0.6-IR31",
    "NETStandard.Library": "1.6.1",
    "System.Data.SqlClient": "4.3.0"
  },

  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  }
}

XXXXXX.BLL(.NET Core Class 库) project.json

{
  "version": "1.0.0-*",

  "dependencies": {
    "Microsoft.Extensions.Configuration.Binder": "1.1.0",
    "NETStandard.Library": "1.6.1",
    "XXXXXX.Application": "1.0.0-*",
    "XXXXXX.Configuration": "1.0.0-*",
    "XXXXXX.DAL": "1.0.0-*",
    "XXXXXX.DataModels": "1.0.0-*"
  },

  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  }
}

最后,.NET Core Web UI 项目将它们联系在一起:

XXXXXX.WebUI project.json

{
  "dependencies": {
    "BundlerMinifier.Core": "2.3.327",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.1.0-preview4-final",
    "Microsoft.AspNetCore.Mvc": "1.1.1",
    "Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final",
    "Microsoft.AspNetCore.Routing": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.NETCore.App": {
      "version": "1.1.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Session": "1.1.0",
    "PaulMiami.AspNetCore.Mvc.Recaptcha": "1.1.1",
    "Microsoft.AspNetCore.Mvc.Abstractions": "1.1.1",
    "Microsoft.Extensions.Options": "1.1.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
    "XXXXXX.DataModels":  {
        "version":"1.0.0-*",
        "target": "project"
    },
    "XXXXXX.Application": {
        "version": "1.0.0-0",
        "target": "project"
    },
    "XXXXXX.Configuration": {
      "version": "1.0.0-*",
      "target": "project"
    },
    "XXXXXX.DAL": {
        "version": "1.0.0-*",
        "target": "project"
    },
    "XXXXXX.BLL": {
         "version": "1.0.0-*",
         "target": "project"
    }
  },

  "tools": {
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true,
    "copyToOutput": [ "web.development.environment.json" ]
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "runtimes": {
    "win10-x64": {},
    "ubuntu.16.04-x64":  {}
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config",
      "global.json",
      "project.json",
      "web.development.environment.json"
    ]
  },

  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

我还有一个 global.json,发布后位于根文件夹中(项目上一级)

{
  "projects": [ 
    "src", 
    "/home/XXXXXX/XXXXXX.Application.dll", 
    "/home/XXXXXX/XXXXXX.Configuration.dll", 
    "/home/XXXXXX/XXXXXX.DataModels.dll", 
    "/home/XXXXXX/XXXXXX.Common.dll",
    "/home/XXXXXX/XXXXXX.BLL.dll", 
    "/home/XXXXXX/XXXXXX.DAL.dll", 
    "/home/XXXXXX/XXXXXX.Notifications.Client.dll", 
    "/home/XXXXXX/XXXXXX.Notifications.DataModels.dll",
    "/home/XXXXXX/XXXXXX.WebUI.dll"
  ]
}

EDIT

VS 中的 publish/build 创建了以下层次结构:

   /home
      /XXXXXX
          /bin
          /refs
          /runtimes
          /Views
          /wwwroot
      global.json
      project.json
      XXXXXX.Configuration.dll
      XXXXXX.Application.dll
      XXXXXX.DataModels.dll
      XXXXXX.BLL.dll
      XXXXXX.DAL.dll
      XXXXXX.WebUI.dll
      web.config
      web.development.environment.json
      (+ Many .NET dlls)

因此,所有项目都已构建并放置在同一级别 - 似乎是错误的,但它是自动化的。

求助!

本质上,问题出现在一些第三方软件包已经转移到仅支持 netcoreapp1.1 的地方。

我在 VS 2017 中重新创建了我的项目(使用旧的 .csproj)升级到 1.1。现在一切正常。

我的建议是获取 VS 2017 并移植任何依赖旧版本 dotnet core 的项目,以避免以后出现 Nuget 问题。

希望该平台在未来几个月内更加稳定。