In .NET 6 and later you don’t need to add Microsoft.AspNetCore.Razor manually, because Razor support is included by default through the Razor SDK. You can safely remove the old reference and everything will still work. If you are working with custom Tag Helpers, use Microsoft.AspNetCore.Razor.TagHelpers instead. For more details, check this related thread: Razor SDK in .NET 6.