0

I am using Visual Studio 2017. Have created a .Net Core Web Application project. I'm trying to add a .Net Framework 4.5 dependency and get the following:

Package X.Y.Z 1.2.0-pre-000394 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package X.Y.Z 1.2.0-pre-000394 supports: net (.NETFramework,Version=v0.0)
Package Microsoft.AspNet.WebApi.Client 5.2.3 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.AspNet.WebApi.Client 5.2.3 supports:
  - net45 (.NETFramework,Version=v4.5)

I'm confused as to whether this is really possible or not using VS 2017 and .Net Core 1.1.1. Is there a way to make this work?

webteckie
  • 428
  • 5
  • 17
  • The main issue was that I had selected the wrong project template. I used the ASP.NET Core Web Application (.NET Core) template when I should have used the ASP.NET Core Web Application (.NET Framework) template. I needed the latter since I need to interact with .NET Framework dependencies in a windows platform. – webteckie Mar 24 '17 at 13:39

1 Answers1

0

Check what framework(s) the package is targeting, and check what framework your project is targeting. As you'll see from my recent question, there is a lot of confusion between the various frameworks and what project types to use in what circumstances.

The first package (X.Y.Z) seems to be targeting the full framework, although it's not clear since there doesn't seem to be a proper version (.NETFramework,Version=v0.0).

Microsoft.AspNet.WebApi.Client is pretty clearly built for the full .NET Framework 4.5, and you can't use it from a .NET Core app. The answers to the question I linked above explain why; portable libraries need to target .NET Standard if they are to be used across different types of framework runtimes (e.g. .NET Framework, .NET Core, Mono). Something built for a specific framework will not automatically port over to the others.

Refer to this chart for info about compatibility.

Community
  • 1
  • 1
Gigi
  • 28,163
  • 29
  • 106
  • 188