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
Comments
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. |
@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. |
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: .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.
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.
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. |
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 Thanks for your time! |
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. |
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 :) |
This appears to be resolved. Let me know if you continue to run into issues. Thanks. |
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.
The text was updated successfully, but these errors were encountered: