honk
honk

Reputation: 591

Errors loading references in Visual Studio 2015 with Aspnet 5

I've started a new set of projects using VS 2015 and ASP.NET 5.

I'm experiencing problems with referencing certain nuget packages. For now I have issues referencing Autofac in the new AspNet 5 class library.

Adding "Autofac": "4.0.0-beta6-110" in project.json just gives me a yellow warning triangle in the references tree with a message saying "Errors - See Error List".

Looking into the Output gives me no errors. Building fails, the project gives me the following error:

Error The dependency Autofac >= 4.0.0-beta6-110 could not be resolved.

Worth knowing is that I've tested with different versions of Autofac so it might have resulted in some package cache hickups.

From an AspNet 5 Web project I also reference Autofac and that seems to work, but in the reference list, Autofac shows up as an ordinary reference (not nuget) showing Autofac 1.0.0 which is incorrect.

Is there anyway to clear dnx package cache? I've tried deleting the folder .dnx/packages without any results.

I can't see that I've done anything wrong inside my projects so there must be some other cause to this.

    {
  "version": "1.0.0-*",
  "description": "ProjectName Class Library",
  "authors": [ "author" ],
  "tags": [ "" ],
  "projectUrl": "",
  "licenseUrl": "",

  "dependencies": {
    "System.Collections": "4.0.10-beta-23019",
    "System.Linq": "4.0.0-beta-23019",
    "System.Threading": "4.0.10-beta-23019",
    "System.Runtime": "4.0.10-beta-23019",
    "Microsoft.CSharp": "4.0.0-beta-23019",
    "Autofac": "4.0.0-beta6-110"
  },

  "frameworks": {
    "dotnet": { }
  }
}

This is the error I get in the solution explorer:

Error message shown in class library

This is how it's getting presented in the web project (even though it uses Autofac 4.0)

enter image description here

Upvotes: 1

Views: 1925

Answers (1)

Henk Mollema
Henk Mollema

Reputation: 46541

Based on your comments, it looks like Autofac doesn't play nice with the dotnet Target Framework Moniker (TFM). Try targeting dnxcore50 in stead:

"frameworks": {
  "dnxcore50": { }
}

Upvotes: 2

Related Questions