5

I'm currently using the following packages for some shared code:

Microsoft.AspNetCore.Authentication.Cookies
Microsoft.AspNetCore.Mvc.Razor
Microsoft.AspNetCore.Mvc.ViewFeatures

They have now been deprecated, and I cannot find a single reference to the one that I should be replacing them with.

Any help would be great.

8
  • At least for ViewFeatures, it looks like it's built-in now, so you can just drop the package as part of a .NET 6 upgrade. See learn.microsoft.com/en-us/answers/questions/915139/…. Could be the same for the others. Commented Jun 5, 2023 at 9:19
  • 3
    I believe the APIs are available "in-box" with newer versions of ASP.NET, like in .NET 6, .NET 7, .NET 8. So, if you're already targeting those versions of the .NET runtime, then you probably don't need those packages at all. If you're not using those runtimes, then that's your upgrade path. Commented Jun 5, 2023 at 9:19
  • generally asking third party stuff like library suggestion is a no go. however, have you read this discussion? Commented Jun 5, 2023 at 9:22
  • @BagusTesa That's not 3rd Party, though. That's basically infrastructure. Commented Jun 5, 2023 at 10:02
  • @Fildor yeah sure, last time asked about oraclejdk/openjdk was downvoted for that exact reason. Commented Jun 5, 2023 at 11:26

1 Answer 1

2

These core ASP.NET Core APIs are now included directly in the .NET SDK as part of a "shared framework."

The fix is to remove the individual package references and instead reference the entire framework.

.csproj

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

  <PropertyGroup>
    <!-- Make sure your target framework is netcoreapp3.1 or newer -->
    <TargetFramework>net8.0</TargetFramework>
  </PropertyGroup>

  <!-- REMOVE  old PackageReference lines -->


  <!--ADD this FrameworkReference instead -->
  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
  </ItemGroup>

</Project>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.