I have three projects under one solution: website (razor pages), model and a class library for creating static HTML documents. For now I only really need the model and the library to be used inside the website, but I separated them in case I need to reuse them later.
I would like to use Html.DisplayNameFor()
and Html.DisplayFor()
inside the class library, since I have already given Display
and DataType
attributes to the model. The problem is that those methods are inside Microsoft.AspNetCore.Mvc.Rendering
namespace.
I tried finding the NuGet package, but only found that Microsoft.AspNetCore.Mvc.ViewFeatures is in 2.2.0 version and it also installs .Http, .Authorization, and other stuff that I don't really need.
I found get the value of DisplayName attribute, but it only works for the name and I believe it would be cumbersome to write something similar for every DataType
as well.
How can I get those two methods inside library? Or could I just merge the library into the website project that has already everything?