Tirupathi Temburu
Tirupathi Temburu

Reputation: 61

Not able to add project reference of .Net Core 2.0 project to Azure functions project(netStandard2.0)

I am using Visual studio 2017 v-15.6.0. my services present in core 2.0 project. i am trying to refer core 2.0 services to azure functions Project(netStandard2.0) Which is not Supporting. I am getting below Error. 'netcoreapp2.0'. It cannot be referenced by a project that targets '.NETStandard,Version=v2.0'. Could you please help me to move forward.

Upvotes: 1

Views: 782

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1064204

The message is entirely correct. netcoreapp2.0 is a framework target; netstandard2.0 is a standard target. Multiple different frameworks implement the same standard, which means that something that targets a standard can't know what framework it will be running on. As such:

  • a project that targets a framework can reference a library that references either the same framework, or a standard that that framework implements - i.e. a netcoreapp2.0 project can reference netcoreapp2.0 or netstandard2.0 libraries
  • a library that targets a standard can reference other libraries that target that standard - i.e. a netstandard2.0 library can reference a netstandard2.0 library

If your project targets netstandard2.0 and the thing you want to reference only targets netcoreapp2.0, then that isn't going to work; either:

  • you can change your project to target the framework: netcoreapp2.0
  • if you control the library, you can try changing the referenced library to target the standard: netstandard2.0

Upvotes: 2

Related Questions