Transpose.Compiler.Library
26.9.5774
See the version list below for details.
dotnet add package Transpose.Compiler.Library --version 26.9.5774
NuGet\Install-Package Transpose.Compiler.Library -Version 26.9.5774
<PackageReference Include="Transpose.Compiler.Library" Version="26.9.5774" />
<PackageVersion Include="Transpose.Compiler.Library" Version="26.9.5774" />
<PackageReference Include="Transpose.Compiler.Library" />
paket add Transpose.Compiler.Library --version 26.9.5774
#r "nuget: Transpose.Compiler.Library, 26.9.5774"
#:package Transpose.Compiler.Library@26.9.5774
#addin nuget:?package=Transpose.Compiler.Library&version=26.9.5774
#tool nuget:?package=Transpose.Compiler.Library&version=26.9.5774
Transpose π - C# to JavaScript compiler
<a href="https://github.com/curiosity-ai/transpose"><img src="https://raw.githubusercontent.com/curiosity-ai/transpose/master/logo/transpose-512.png" width="120" height="120" align="right" /></a>
Transpose is a modern C# β JavaScript compiler built entirely on Roslyn.
It is the next generation of the h5 project
(itself a fork of the original Bridge
compiler), rebranded and rebuilt around a clean-room Roslyn translator. The
legacy Bridge/NRefactory pipeline has been removed β Transpose is solely the
Roslyn-based translator and its CLI compiler (tps).
The compiler runs on .NET 10.0; Transpose projects target .NET Standard 2.0/2.1. Transpose targets a fast, integrated development experience for C# web developers.
Coming from h5? See MIGRATION.md for a step-by-step guide to porting an existing h5 project.
| Package | NuGet |
|---|---|
| Base Library | |
| Core Library | |
| SDK Target | |
| Json Library | |
| Template | |
| Compiler as a Library | |
| UI Toolkit |
The base library's package id is
Transpose.BCL, but its assembly isTranspose(so the DLL staysTranspose.dlland the runtime global in generated JS isTranspose).
Getting Started β‘
A Transpose project references the Transpose.Build.Target SDK, which runs the
tps compiler as part of a normal dotnet build β there is no global-tool
compiler to install and no compilation server. Start from this project shape
(replace * with the latest published versions):
<Project Sdk="Transpose.Build.Target/*">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Transpose.BCL" Version="*" />
<PackageReference Include="Transpose.Core" Version="*" />
</ItemGroup>
</Project>
Build it with a plain:
dotnet build
The output (the tps.js runtime, your app.js bundle, resources, and
index.html) lands under bin/<Configuration>/<tfm>/tps/. Serve it locally:
cd bin/Debug/netstandard2.0/tps/
dotnet serve --port 5000
You can also install the dotnet new template and scaffold a project:
dotnet new install Transpose.Template
dotnet new transpose
How a build works
tps reads the .csproj directly (no MSBuild evaluation), globs **/*.cs,
resolves PackageReferences from the NuGet cache, transpiles, and writes either
a runnable site or β for a library β a .NET DLL with the compiled JS embedded.
Behavior is configured per project by a tps.json file (output path,
fileName, html, reflection, resources). Whether the emitted JavaScript is
formatted, minified or split into on-demand modules is not configured there: it
follows from the build β formatted in Debug, minified (or chunked) in Release, and
all three variants in a library package, so each consumer picks its own.
When a project references another project, the site build consumes the referenced project's already-built package DLL (extracting its compiled JS) instead of recompiling its sources β so a dependency is compiled once and reused.
Restoring packages without the .NET SDK
tps resolves PackageReferences out of the NuGet global-packages folder, and
filling that folder used to be dotnet restore's job β which made the .NET SDK a
prerequisite of compiling with a tool that otherwise needs nothing but itself. It
now installs them itself:
tps restore MyApp.csproj
tps MyApp.csproj # β¦or `tps MyApp.csproj --restore` to do both
It reads the nuget.config chain, fetches from a V3 feed or a plain folder of
.nupkg files (--source, repeatable, consulted before the configured sources),
and lays each package out exactly as NuGet does β so a later dotnet restore over
the same folder accepts what it finds as already installed, and vice versa. This
restores what the compiler binds against; building the same project through
MSBuild additionally needs its SDK package, which only MSBuild resolves. Lock
files, package-source mapping, authenticated feeds and floating versions are out
of scope.
The same thing is available in process through Transpose.Compiler.Library:
var restored = await TransposeCompilerLibrary.RestoreAsync(
new RestoreRequest("/src/App/App.csproj") { OnProgress = Console.WriteLine });
Compiling from your own .NET application
Transpose.Compiler.Library lets a .NET application compile C# source held in
memory to JavaScript in process, with no tps process, .csproj, or disk I/O
involved:
<PackageReference Include="Transpose.Compiler.Library" Version="*" />
using Transpose.Compiler.Library;
var result = TransposeCompilerLibrary.Compile(
new CompilationRequest("App")
.WithSourceFile("Program.cs", "System.Console.WriteLine(\"Hello!\");"));
if (result.Success) Console.WriteLine(result.Javascript);
else foreach (var error in result.Errors) Console.Error.WriteLine(error);
CompilationRequest also supports .WithPackageReference(id, version) (resolved
from the local NuGet cache, exactly like a csproj <PackageReference>),
.WithReferenceAssembly(path), .WithRuntime() (prepend the tps.js runtime so
the output is directly runnable), and .AsPackageAssembly() (also emit a .NET
assembly with the JS embedded, like tps --emit-package). An async
CompileAsync is available too; concurrent calls in one process are queued and
run one at a time (see the type's XML docs for why).
Samples
The Tesserae UI toolkit and its sample app are built with Transpose and are a good end-to-end reference.
Relationship to h5 π
Transpose is the evolution of h5, with two large changes:
- Roslyn rebuild. The translator was rewritten as a clean-room Roslyn
compiler. The emitter walks Roslyn syntax trees guided by the semantic model
and emits JavaScript directly β there is no NRefactory and no
SharpSixRewriterlowering pass. - Rebrand.
H5βTranspose(namespaces, runtime global, assembly names) andh5βtps(runtime file, config file, module name, compiler command). A handful of non-library tokens are deliberately preserved β the<h5>HTML tag binding and hash localsh1..h5β so they are not renamed.
The compiler is a plain CLI: caching and the hosted compilation server are out of scope by design. Retyped/Bridge packages are not supported.
Package/SDK renames (h5 β Transpose):
h5βTranspose.BCL(assembly staysTranspose)h5.CoreβTranspose.Coreh5.Target(SDK) βTranspose.Build.Targeth5.Newtonsoft.JsonβTranspose.Newtonsoft.Jsonh5.WebGL2βTranspose.WebGL2h5.templateβTranspose.Template
See MIGRATION.md for the full porting guide.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.CodeAnalysis.CSharp (>= 5.6.0)
- Mono.Cecil (>= 0.11.6)
- NUglify (>= 1.21.15)
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 |
|---|---|---|
| 26.10.6379 | 167 | 10/5/2026 |
| 26.10.6207 | 366 | 10/1/2026 |
| 26.9.5837 | 485 | 9/24/2026 |
| 26.9.5774 | 119 | 9/23/2026 |
| 26.9.5288 | 678 | 9/16/2026 |
| 26.9.5282 | 96 | 9/16/2026 |
| 26.9.5180 | 203 | 9/14/2026 |
| 26.9.5174 | 95 | 9/14/2026 |
| 26.9.4868 | 281 | 9/9/2026 |
| 26.9.4828 | 113 | 9/7/2026 |
| 26.9.4790 | 116 | 9/4/2026 |
| 26.8.4686 | 119 | 8/30/2026 |
| 26.8.4640 | 141 | 8/28/2026 |
| 26.8.4627 | 114 | 8/28/2026 |
| 26.8.4618 | 103 | 8/28/2026 |
| 26.8.4614 | 103 | 8/27/2026 |
| 26.8.4595 | 108 | 8/27/2026 |
| 26.8.4593 | 114 | 8/27/2026 |
| 26.8.4567 | 105 | 8/26/2026 |
| 26.8.4554 | 103 | 8/26/2026 |