Many libraries that create html rely on HtmlTextWriter. Is there an equivalent to this class in the new corefx?
Here are a few projects that rely on HtmlTextWriter: https://github.com/darthfubumvc/htmltags https://fluenttags.codeplex.com/
An alternative question might be: "What is the best way to generate html using dotnet core / corefx?"
NET Core platform such as mobile, desktop, web, cloud, IoT, machine learning, microservices, game, etc. Supports Multiple Languages: You can use C#, F#, and Visual Basic programming languages to develop .
HtmlTextWriter writes HTML. It allows you to generate a list of HTML elements, such as div elements. You could use StringBuilder, but HtmlTextWriter is sometimes better. Notes, HTML. It is easy to generate HTML using StringBuilder, just like any other string.
ASP.NET Core is a cross-platform, high-performance, open-source framework for building modern, cloud-enabled, Internet-connected apps. With ASP.NET Core, you can: Build web apps and services, Internet of Things (IoT) apps, and mobile backends. Use your favorite development tools on Windows, macOS, and Linux.
At this point, if your NuGet dependencies are compatible with both your netcore and netframework targets you may be done! The big news here is that most of your NuGet dependencies are compatible with both. All of the most downloaded NuGet packages are either multi-targeted, or have packages for each target.
There's a super easy fix that I've tested working on .NET core 3.1 and .NET 5. Just install NuGet package HtmlTextWriter in your .NET core project and that's it.
.NET Core 2.0
does not support HtmlTextWriter
class.
You could work around this by moving your logic, which uses HtmlTextWriter
, to the class library .NET Standard 2.0
. Then you will be able to reference this class library from both - .NET Core
and .NET Framework
projects.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With