Tooling: Cannot reference .NET Core Class Library project from ASP .NET Core Web Applicaiton project

Created on 11 Jul 2016  路  13Comments  路  Source: aspnet/Tooling

I created a new ASP .NET Core Web Applicaiton project, then I created a .NET Core Class Library project in the same solution. From the Web project I referenced the library but I'm getting Cannot resolve symbol errors.

It seems other people ran into this issue but for some reason it was closed (https://github.com/aspnet/Tooling/issues/245). I have the latest tooling as far as I can tell but the issue still seems to be happening, so I'm not sure why it was closed.

Here's my ASP .NET Core project.json file:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Vcs.Svc.MerchantProduct.Domain": "1.0.0-*"
  },

  "tools": {
    "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",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  },

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

And here's my .NET Core class library project.json file:

锘縶
  "version": "1.0.0-*",

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

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

Most helpful comment

I have the same problem with my base template for Core library creating:
` "dependencies": {
"NETStandard.Library": "1.6.0"
},

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

and my base template for Web(Core) core application creating:
"dependencies": { "Microsoft.NETCore.App": { "version": "1.0.0", "type": "platform" } ... "frameworks": { "netcoreapp1.0": { "imports": [ "dotnet5.6", "portable-net45+win8" ] } },

I think it is because the .NetStandard, Version=v1.6 pulls in the nuget Microsoft.NETCore.Platforms(1.0.1)
image

All 13 comments

I have the same problem with my base template for Core library creating:
` "dependencies": {
"NETStandard.Library": "1.6.0"
},

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

and my base template for Web(Core) core application creating:
"dependencies": { "Microsoft.NETCore.App": { "version": "1.0.0", "type": "platform" } ... "frameworks": { "netcoreapp1.0": { "imports": [ "dotnet5.6", "portable-net45+win8" ] } },

I think it is because the .NetStandard, Version=v1.6 pulls in the nuget Microsoft.NETCore.Platforms(1.0.1)
image

TFS Bug#241383

@vfrank66 what version of NuGet is installed in Visual Studio (can be found in Help -> About)?

I'm facing the same problem. Did you find how to solve it?

Same problem here. I tried to workaround by creating a console app and converting to class library, but unfortunately that option is not available.

Edit: Okay, found a workaround. Go to project.json and set emitEntryPoint to false for your console app. Hopefully it is now equivalent to a class library.

I'm having the same issue as well. I've tried to uninstall and reinstall Visual Studio Community Update 3. I've also uninstalled .NET core 1.0.0 - VS Tooling Preview 2. Nuget package manager is v.3.5.0. Any existing core solution that I have created has this issue. Any new Core solutions also have this issue. What's interesting is that a friend of my shared a git repo that he created and I am able to reference core class libraries in that core web application.

I get the issue to,How can I DO

I have the same problem. Is there any way to fix it ?

Experiencing this issue as well, any update or workarounds?

I fixed it by installing the latest version of resharper.

Updating resharper solved the issue for me as well, thanks @paradise!!

@paradise i just installed the latest version of resharper, but i'm still facing the same issue..
Adding the dependency manually to the project.json file, solved it for me

I had the same issue. Uninstalling .NET and VS2015, then reinstalling did not for me. I had to do a machine reset and a clean VS2015, etc install - which then worked fine.

My assumption was: windows had a bunch of earlier (prerelease) versions of ASP.NET Core & .NET Core that go tin the way

Was this page helpful?
0 / 5 - 0 ratings