#
H5: The C# to JavaScript Compiler
Build the modern web with the language you love. H5 brings the full power, type safety, and productivity of C# directly to the browser.
#
Why H5?
#
🚀 C# Power, JavaScript Reach
Write your application logic, UI components, and complex algorithms in C#. H5 compiles your code into clean, high-performance JavaScript that runs in any browser, on any device—from mobile to desktop.
#
🛡️ Real Type Safety
Eliminate "undefined is not a function" forever. Leverage C#’s strong typing, generics, and compile-time checks to catch errors before they ever reach your users.
#
📦 Seamless Ecosystem Integration
Don't choose between .NET and JavaScript. Use h5.Core to access the full DOM and ES5/6+ APIs, or integrate your favorite npm libraries like React, Vue, or jQuery with ease.
#
⚡ Built for Performance
H5 features a hosted compiler process that speeds up your development cycle. It produces human-readable, optimized JavaScript and full sourcemaps, making debugging in the browser as easy as debugging in Visual Studio.
#
Write C#. Run Everywhere.
H5 transforms your C# classes into optimized JavaScript structures while maintaining the logic and behavior you expect from the .NET runtime.
#
The C# Source
public class TodoItem
{
public int Id { get; set; }
public string Task { get; set; }
public bool IsDone { get; set; }
public void Toggle()
{
this.IsDone = !this.IsDone;
Console.WriteLine($"Task {Id} is now {(IsDone ? "done" : "pending")}");
}
}
#
The H5 Output
H5.define("App.TodoItem", {
props: {
Id: 0,
Task: null,
IsDone: false
},
methods: {
Toggle: function () {
this.IsDone = !this.IsDone;
System.Console.WriteLine("Task " + this.Id + " is now " + (this.IsDone ? "done" : "pending"));
}
}
});
#
Modern Tooling for Modern Devs
H5 is built for the current .NET ecosystem, fitting perfectly into your existing workflow.
- Standardized: Projects target .NET Standard 2.1, enabling compatibility with shared back-end projects.
- CLI First: The compiler is distributed as a dotnet global tool, making CI/CD and automation effortless.
- SDK-Style: No more legacy
.csprojbloat. H5 uses modern, clean SDK-style project files. - IDE Support: Full Intellisense and statement completion in Visual Studio and VS Code.
#
Powerful Extensions
Expand your capabilities with purpose-built H5 packages:
- h5: Core library providing a .NET-equivalent runtime for the browser.
- h5.Core: Core library providing strongly typed bindings for the HTML5 API.
- h5.Newtonsoft.Json: JSON serialization support in the browser with a Newtonsoft.Json style API.
- h5.WebGL2: Build high-performance 3D games and visualizations using C#.
#
Get Started in Seconds
H5 is available via NuGet and the dotnet CLI.
1. Install the H5 Compiler:
dotnet tool install -g h5-compiler
2. Create a new H5 project using a .NET template:
dotnet new install h5.Template
dotnet new h5 -n MyWebProject
3. Build and Run:
dotnet tool install --global dotnet-serve
dotnet build
dotnet serve .\bin\Debug\netstandard2.1\h5\
#
Ready to build?
Download H5 on NuGet | View Documentation | Explore Samples
H5: The next generation of C# web development.