Skip to content
This repository has been archived by the owner on Apr 11, 2020. It is now read-only.

Cannot reference .NET Core Class Library project from ASP .NET Core Web Applicaiton project #664

Closed
sethmoore opened this issue Jul 11, 2016 · 13 comments

Comments

@sethmoore
Copy link

sethmoore commented Jul 11, 2016

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 (#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"
    }
  }
}
@vfrank66
Copy link

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

@mlorbetske
Copy link

TFS Bug#241383

@mlorbetske
Copy link

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

@Jeffersus
Copy link

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

@rizzom5000
Copy link

rizzom5000 commented Aug 24, 2016

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.

@jeremyfoster
Copy link

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.

@shcemApp
Copy link

shcemApp commented Sep 6, 2016

I get the issue to,How can I DO

@paradise
Copy link

paradise commented Sep 7, 2016

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

@cjablonski76
Copy link

Experiencing this issue as well, any update or workarounds?

@paradise
Copy link

I fixed it by installing the latest version of resharper.

@cjablonski76
Copy link

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

@mkeymolen
Copy link

@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

@guylangston
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests