HtmlCSBuilder 2022.0.0

dotnet add package HtmlCSBuilder --version 2022.0.0                
NuGet\Install-Package HtmlCSBuilder -Version 2022.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HtmlCSBuilder" Version="2022.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HtmlCSBuilder --version 2022.0.0                
#r "nuget: HtmlCSBuilder, 2022.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HtmlCSBuilder as a Cake Addin
#addin nuget:?package=HtmlCSBuilder&version=2022.0.0

// Install HtmlCSBuilder as a Cake Tool
#tool nuget:?package=HtmlCSBuilder&version=2022.0.0                

HtmlCSBuilder

Library to write HTML documents using .NET

Syntax Example

Example of basic html

<html>
    <body class="main_body">
        <h1>Heading</h1>
        <p>This is a paragraph</p>
    </body>
</html>

HtmlCSBuilder syntact to write the html sample:

HtmlBuilder builder = new HtmlBuilder();

using (builder.AddTag(HtmlTag.Html))
{
	using (builder.AddTag(HtmlTag.Body, (HtmlAttribute.Class, "main_body")))
	{
		using (builder.AddTag(HtmlTag.H1))
		{
			builder.WriteLine("Heading");
		}

		using (builder.AddTag(HtmlTag.P))
		{
			builder.WriteLine("This is a paragraph");
		}
	}
}

Write once use it everywhere, you can have an html splited in different HtmlBuilders and merge them in the different documents, for example you can setup a default header and footer and use the same bulider for all your pages:

<html>

    
    <head>
        <title>
            This is the default title for all pages
        </title>
    </head>

    
    <body>
        Dynamic main content in this html page
    </body>

    
    <footer>
        <p>
            Author: this is the author of the pages
        </p>
    </footer>
</html>

C# example for how to create the static elements in the html:

HtmlBuilder page1 = new HtmlBuilder();

using (page1.AddTag(HtmlTag.Html))
{
	page1.AddChunk(header());

	using (page1.AddTag(HtmlTag.Body))
	{
		page1.WriteLine("Dynamic main content in this html page 001");
	}

	page1.AddChunk(footer());
}

Where header() and footer() implementation looks like:

private static HtmlBuilder header()
{
	HtmlBuilder head = new HtmlBuilder();

	using (head.AddTag(HtmlTag.Head))
	{
		using (head.AddTag(HtmlTag.Title))
		{
			head.WriteLine("This is the default title for all pages");
		}
	}

	return head;
}

private static HtmlBuilder footer()
{
	HtmlBuilder foot = new HtmlBuilder();

	using (foot.AddTag(HtmlTag.Footer))
	{
		using (foot.AddTag(HtmlTag.P))
		{
			foot.WriteLine("Author: this is the author of the pages");
		}
	}

	return foot;
}
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net5.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2022.0.0 242 5/29/2022