Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Microsoft.AspNetCore.Mvc.Core with version 3.1.0 from NuGet?

Tags:

asp.net-core

I have a netstandard2.0 class library project, which depend on Microsoft.AspNetCore.Mvc.Core with version 2.1.1. I am presently trying to upgrade this project to netstardand2.1,being used by a netcore3.1 application, but I find that the package Microsoft.AspNetCore.Mvc.Core with version 3.1.0 is not available on NuGet? Where can I find this package?

like image 598
LoremIpsum Avatar asked Dec 07 '22 10:12

LoremIpsum


1 Answers

I found this solution in ASP.NET Core 3.1 documentation.

With the release of .NET Core 3.0, many ASP.NET Core assemblies are no longer published to NuGet as packages. Instead, the assemblies are included in the Microsoft.AspNetCore.App shared framework, which is installed with the .NET Core SDK and runtime installers. For a list of packages no longer being published, see Remove obsolete package references

As of .NET Core 3.0, projects using the Microsoft.NET.Sdk.Web MSBuild SDK implicitly reference the shared framework. Projects using the Microsoft.NET.Sdk or Microsoft.NET.Sdk.Razor SDK must reference ASP.NET Core to use ASP.NET Core APIs in the shared framework.

To reference ASP.NET Core, add the following element to your project file: (*.csproj file)

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

</Project>

For more details visit this link: Use ASP.NET Core APIs in a class library

like image 124
Ramil Aliyev Avatar answered Dec 10 '22 00:12

Ramil Aliyev