Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The package does not support .NetFramework, version=4.5. #211

Closed
haykbaluyan opened this issue Nov 11, 2017 · 7 comments
Closed

The package does not support .NetFramework, version=4.5. #211

haykbaluyan opened this issue Nov 11, 2017 · 7 comments

Comments

@haykbaluyan
Copy link

Hi

Just tried to install the package on a project targeting .Net 4.5 and got the below error. Is this expected? If so, is there an intention to support 4.5 in the future? Thanks.

Could not install package 'Microsoft.AspNetCore.Mvc.Versioning 2.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

@commonsensesoftware
Copy link
Collaborator

Are you looking the ASP.NET Web API or ASP.NET Core version of the package? The package id that you listed is for ASP.NET Core, which has never supported .NET 4.5. ASP.NET Core 1.0/1.1 target .NET 4.5.1 and .NET Standard 1.6. ASP.NET Core 2.0 targets .NET Standard 2.0, which maps to .NET 4.6.1 and above.

If you're looking for the ASP.NET Web API version of the package, you can find it here. That version does target .NET 4.5.

I hope that helps.

@joaocpribeiro
Copy link

@commonsensesoftware, I am trying to add the nuget package Microsoft.AspNetCore.Mvc.Versioning for a .NET Core 2.0 project that targets .NET Framework 4.6.2.
It says it is incompatible: "Package Microsoft.AspNetCore.Mvc.Versioning 2.0.0 is not compatible with net462 (.NETFramework,Version=v4.6.2). Package Microsoft.AspNetCore.Mvc.Versioning 2.0.0 supports: netstandard2.0 (.NETStandard,Version=v2.0)"
Is there any way to use Microsoft.AspNetCore.Mvc.Versioning in this project without changing its target?

@commonsensesoftware
Copy link
Collaborator

Please correct me if I'm wrong, but I think there is a mix-up of terminology and possibly tooling. Let me clarify.

The latest version of API versioning for ASP.NET Core targets .NET Standard 2.0. The dependency graph looks like: API Versioning 2.0 → ASP.NET Core 2.0 → .NET Standard 2.0

.NET Standard is not a target platform, but rather a contract for a set of APIs that are platform-neutral. This means that libraries that target .NET Standard 2.0 can run on both the .NET Framework and .NET Core. .NET Standard 2.0 is compatible with the .NET Framework 4.6.1 and later.

Note: The .NET Standard 2.0 tooling is available in Visual Studio 2017 15.3 and above. I'm not sure about Visual Studio 2015, if that applies to you.

It's not possible to target .NET Framework 4.6.2 (net462) for a .NET Core (netcoreapp2.0) application. It is, however, possible to create an ASP.NET Core 2.0 application that targets either .NET Framework 4.6.2 or .NET Core 2.0.

Aside: Thanks marketing guys for overloading the term "Core"

I suppose the proof is in the pudding, so here's what a working project with ASP.NET Core 2.0 and API Versioning 2.0 that target the .NET Framework 4.6.2 should look like:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net462</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore" Version="2.0.1" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.1" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="2.0.0" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.1" />
  </ItemGroup>
</Project>

I'm happy to attach the full project here for you if it's useful, but these should be the only relevant tastey bits.

@joaocpribeiro
Copy link

In fact I was mixing up both Core terms. Sorry about that.

I found out that my problem was not related with this package. It was a VS issue. It was something similar to this: https://stackoverflow.com/questions/45802909/updating-to-asp-net-core-2-0-packages-are-not-compatible-with-netcoreapp2-0
I updated VS from version 15.2.? to 15.4.4 and then the package could be installed.

Thanks for your time!

@commonsensesoftware
Copy link
Collaborator

No problem. Yeah - this is because ASP.NET Core moved to .NET Standard 2.0. The tooling for it only became available in Visual Studio 15.3+.

I hit this issue myself and the error messages are ... well ... less than helpful. Some folks asked for preview versions as well. You can imagine how much fun that was. >_<

Glad you got things working.

@haykbaluyan
Copy link
Author

Thanks @commonsensesoftware and @joaocpribeiro. I think my issue is also about VS2013 vs VS2017. I will find some time to upgrade my tools and use VS2017. I bet the issue will go away as you guys also noted :)

@commonsensesoftware
Copy link
Collaborator

This appears to be resolved. Let me know if you continue to run into issues. Thanks.

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

No branches or pull requests

3 participants