Microsoft.AspNetCore.Razor replacement?

1.9k views Asked by At

On the MS website itself they advice to use the Microsoft.AspNetCore.Razor namespace for building custom tags: https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/authoring?view=aspnetcore-6.0

However Microsoft.AspNetCore.Razor is deprecated in Nuget. Any idea what to sue instead?

1

There are 1 answers

0
Chen On

If a Nuget package will be deprecated, it means that there is already a solution to replace it, which may be integrated within the framework, or there may be a new Nuget package.

I'm not sure why you need to use the Microsoft.AspNetCore.Razor Namespace when customizing TagHelper, but its role is to provide support classes for the design-time and runtime experience of the Razor language. And In subsequent .net versions, the ASP.NET Core Razor SDK is included, which will be applied to your application by default:

The Razor SDK:

Is required to build, package, and publish projects containing Razor files for ASP.NET Core MVC-based or Blazor projects.

Includes a set of predefined properties, and items that allow customizing the compilation of Razor (.cshtml or .razor) files.

Of course, if it's just custom tags, I think Microsoft.AspNetCore.Razor.TagHelpers Namespace may be more appropriate.

If you have other logic that must use Microsoft.AspNetCore.Razor, you can provide a minimal reproducible example.