Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to resolve error when try dotnet restore multi project solution

I've got a solution that builds locally and I've created a new build and added one step to it

dotnet restore

I'm getting this error message:

    ... OTHER SUCCESSFUL INSTALLATIONS ...
    log  : Installing Microsoft.Extensions.FileProviders.Abstractions 1.0.0.
    log  : Installing Microsoft.Extensions.Configuration.Abstractions 1.0.0.
    log  : Installing Microsoft.Extensions.DependencyInjection.Abstractions 1.0.0.
    log  : Writing lock file to disk. Path: C:\a\1\s\Wedding.WebApp\project.lock.json
    log  : C:\a\1\s\Wedding.WebApp\project.json
    log  : Restore failed in 13722ms.
    Errors in C:\a\1\s\Wedding.WebApp\project.json
        Unable to resolve 'Wedding.Application' for '.NETFramework,Version=v4.6.1'.
        Unable to resolve 'Wedding.Common' for '.NETFramework,Version=v4.6.1'.
        Unable to resolve 'Wedding.WebApp.Setup' for '.NETFramework,Version=v4.6.1'.

Its refering to the three other projects that my main web project references.

This is my project.json

    {
      "dependencies": {
        "Microsoft.AspNetCore.Diagnostics": "1.0.0",
        "Microsoft.AspNetCore.Mvc": "1.0.1",
        "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
        "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
        "Microsoft.AspNetCore.StaticFiles": "1.0.0",
        "Microsoft.Extensions.Configuration.Json": "1.0.0",
        "Microsoft.Extensions.Logging.Console": "1.0.0",
        "Microsoft.Extensions.Logging.Debug": "1.0.0"
      },

      "tools": {
        "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
        "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
      },

      "frameworks": {
        "net461": {
          "dependencies": {
            "Wedding.Application": {
              "target": "project"
            },
            "Wedding.Common": {
              "target": "project"
            },
            "Wedding.WebApp.Setup": {
              "target": "project"
            }
          }
        }
      },

      "buildOptions": {
        "emitEntryPoint": true,
        "preserveCompilationContext": true
      },

      "publishOptions": {
        "include": [
          "wwwroot",
          "web.config"
        ]
      },

      "scripts": {
        "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
      }
    }

Does anyone know why this might be erroring?

like image 729
chris31389 Avatar asked Sep 13 '16 21:09

chris31389


1 Answers

Your dependencies and frameworks block don't look correct to me: I would expect the libraries you depend on to be declared within the dependencies block, not the frameworks block. It would more typically resemble this, for one project referencing another:

{

  "dependencies": {
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Wedding.Application": { "target": "project" },
    "Wedding.Common": { "target": "project" },
    "Wedding.WebApp.Setup": { "target": "project" }
  },

  "frameworks": {
    "net461": {
      "imports": []
    }
  },

  ...
}
like image 167
Ken Mason Avatar answered Oct 05 '22 13:10

Ken Mason