CSharpToJavaScript 0.2.1
dotnet add package CSharpToJavaScript --version 0.2.1
NuGet\Install-Package CSharpToJavaScript -Version 0.2.1
<PackageReference Include="CSharpToJavaScript" Version="0.2.1" />
<PackageVersion Include="CSharpToJavaScript" Version="0.2.1" />
<PackageReference Include="CSharpToJavaScript" />
paket add CSharpToJavaScript --version 0.2.1
#r "nuget: CSharpToJavaScript, 0.2.1"
#:package CSharpToJavaScript@0.2.1
#addin nuget:?package=CSharpToJavaScript&version=0.2.1
#tool nuget:?package=CSharpToJavaScript&version=0.2.1
CSharpToJavaScript
Nuget package | CLI | Website | Try it online!
This library is the "core" where all the "magic" happens for translating/converting C# into JS, using Roslyn.
It is recommended to use the CLI/dotnet tool unless you want to write the front-end by yourself. Look for the implementation in the CLI, BWA app or the simple "Hello world" example below.
The CLI/dotnet tool is a simple cli front-end that behaves more or less like the dotnet cli, tsc cli, meson.
Status
test262-parser(master): Only JS part (code is not public, yet. ES5 implemented) Total tests: 5363 | Passed: 2824 (52 %) | Failed: 2539
test262(es5 branch): Total tests: 11725 | Passed: 1272 (10 %)** | Failed: 10453
**Note: Tests run with "UseVarOverLet" option, using Jint as an engine.
Hello world
- Install the NuGet package or download a specific version.
- Skip this if using a Nuget package. Follow the instructions on how to add a project reference.
- In the Main method, add:
FileData file = new()
{
SourceStr = @"Console.WriteLine(""Hello world."");"
};
file = CSTOJS.Translate(file);
Console.WriteLine(file.TranslatedStr);
- Run a program
- Console output should be:
console.log("Hello world.");
FileData file = new()
{
OptionsForFile = new(){ Debug = true },
...
};
...
Related Repository
- Dotnet tool/CLI for this library: https://github.com/TiLied/CSTOJS_CLI
- Tests: https://github.com/TiLied/CSTOJS_Tests
- Library for generating various things: https://github.com/TiLied/CSTOJS_GenLib
- Website/documentation: https://github.com/TiLied/CSTOJS_Pages
- Blazor WebAssembly app: https://github.com/TiLied/CSTOJS_BWA
| 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.0.0)
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 |
|---|---|---|
| 0.2.1 | 98 | 4/27/2026 |
| 0.2.0 | 99 | 4/20/2026 |
| 0.1.10 | 114 | 3/7/2026 |
| 0.1.9 | 104 | 3/4/2026 |
| 0.1.8 | 115 | 2/23/2026 |
| 0.1.7 | 111 | 2/23/2026 |
| 0.1.6 | 128 | 2/9/2026 |
| 0.1.5 | 119 | 1/26/2026 |
| 0.1.4 | 214 | 12/22/2025 |
| 0.1.3 | 280 | 12/15/2025 |
| 0.1.2 | 474 | 12/8/2025 |
| 0.1.1 | 241 | 11/24/2025 |
| 0.1.0 | 182 | 9/27/2025 |
| 0.0.10 | 316 | 9/15/2025 |