1

I am attempting to deploy a .NET Core app on Ubuntu 16.04. The project contains references to other projects (i.e. not via nuget), locally the app works fine (win10-x64) however on the server when typing dotnet restore I receive the following log:

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: 

I have reviewed the advice in the related questions here, here and here however none of the solutions seem to fix my issue.

Given the pace of change to the Core framework I will specify the versions in use and the project.json files for the projects:

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

{
  "version": "1.0.0-*",

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

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

XXXXXX.DataModels (.NET Core Class Library) 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 Library) 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 Library) 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 Library) 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"
    }
  }
}

And finally, the .NET Core Web UI proejct which ties it all together:

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%" ]
  }
}

I also have a global.json which when published resides in the root folder (one level above the projects)

{
  "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

The publish/build within VS created the following hierarchy:

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

So, all projects were build and placed at the same level - seems wrong but hey it's automated.

Help!

Community
  • 1
  • 1
o-o-awake-o-o
  • 397
  • 1
  • 3
  • 18
  • Are you running different versions of the dotnet core runtime between your dev workstation and the Ubuntu server? You can check that with dotnet --version. Also, have you considered moving to preview 4 of the framework and migrating your projects to .csproj files? I've found they have e better support for project references. – Nick DeMayo Feb 18 '17 at 04:19
  • Hi Nick, Yes the versions are the same. I read they decided to change tact and move from json back to the older XML config style. However, It was deemed not commercially viable to burn time transferring all projects in this solution over. This is a paid project which budget must be preserved :( Any other possibilities? – o-o-awake-o-o Feb 20 '17 at 09:40
  • Both environments are running `1.0.0-preview2-1-003177` – o-o-awake-o-o Feb 20 '17 at 09:41
  • Have you tried doing an individual restore/build on each project, in their dependent order, rather than building the whole solution? – Nick DeMayo Feb 20 '17 at 14:35
  • Hi Nick, Thanks so much for continuing to help me. Actually, the way that VS published it, all projects seem to be within the same level (i.e. no "src" folder". The build tool has placed them all in `/home/XXXXXX/XXXXXX.dll` – o-o-awake-o-o Feb 20 '17 at 15:59
  • Ok, just want to make sure I understand... you're doing the dotnet restore in the published /home/XXXXXX folder, correct? If so, shouldn't your global.json project paths be more like `"/home/XXXXXX.Application.dll"`? – Nick DeMayo Feb 21 '17 at 20:11

1 Answers1

0

Essentially the problem arises where some Third Party packages have moved on to support netcoreapp1.1 only.

I recreated my projects in VS 2017 (using ye olde .csproj) did an upgrade to 1.1. All works fine now.

My advice is to get VS 2017 and port any project reliant on older versions of dotnet core to avoid Nuget issues later.

Here's hoping for more stability in the platform in the coming months.

o-o-awake-o-o
  • 397
  • 1
  • 3
  • 18