David Kuzmin
David Kuzmin

Reputation: 81

Trying to reference a .NET 4.6.1 class library from a .NET Core project

Screenshots => https://i.sstatic.net/o4FwD.jpg

I'm trying to reference a .NET 4.6.1 Class library in a .NET Core 1.0.0 project. It's added to references but whenever I try to include the "using" statement in a controller I get "the type or namespace could not be found error."

Any suggestions?

Upvotes: 0

Views: 79

Answers (2)

gilmishal
gilmishal

Reputation: 2032

You can either only target .NET 4.6.1, and that way you would not support .net core. Or you can add #if NET461 directives in your code, and that way it will be able to find the type and namespace in the if.

your problem is that the code is unsupported in .net core, and therefore cannot build for .net core

Upvotes: 1

Martin
Martin

Reputation: 1150

You need to set .NET 4.6.1 as the framework for the project. In your project.json, replace the "frameworks"-section with:

"frameworks": 
{
   "net461": {}
}

Upvotes: 0

Related Questions