CSharpToJavaScript 0.2.0
See the version list below for details.
dotnet add package CSharpToJavaScript --version 0.2.0
NuGet\Install-Package CSharpToJavaScript -Version 0.2.0
<PackageReference Include="CSharpToJavaScript" Version="0.2.0" />
<PackageVersion Include="CSharpToJavaScript" Version="0.2.0" />
<PackageReference Include="CSharpToJavaScript" />
paket add CSharpToJavaScript --version 0.2.0
#r "nuget: CSharpToJavaScript, 0.2.0"
#:package CSharpToJavaScript@0.2.0
#addin nuget:?package=CSharpToJavaScript&version=0.2.0
#tool nuget:?package=CSharpToJavaScript&version=0.2.0
CSharpToJavaScript
Nuget package | CLI | Website | Try it online!
This library is a "core" where all the "magic" happens for translating/converting cs into js, using Roslyn. You should use the CLI/dotnet tool, it behaves more or less like dotnet cli, tsc cli, meson. Look for the implementation in CLI, BWA app or simple "Hello world" below.
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 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 a library: https://github.com/TiLied/CSTOJS_CLI
- Tests: https://github.com/TiLied/CSTOJS_Tests
- Library for generating various stuff: 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 | 108 | 4/27/2026 |
| 0.2.0 | 109 | 4/20/2026 |
| 0.1.10 | 125 | 3/7/2026 |
| 0.1.9 | 112 | 3/4/2026 |
| 0.1.8 | 121 | 2/23/2026 |
| 0.1.7 | 117 | 2/23/2026 |
| 0.1.6 | 136 | 2/9/2026 |
| 0.1.5 | 126 | 1/26/2026 |
| 0.1.4 | 222 | 12/22/2025 |
| 0.1.3 | 287 | 12/15/2025 |
| 0.1.2 | 481 | 12/8/2025 |
| 0.1.1 | 250 | 11/24/2025 |
| 0.1.0 | 190 | 9/27/2025 |
| 0.0.10 | 323 | 9/15/2025 |
- [Small clean up.](https://github.com/TiLied/CSharpToJavaScript/commit/bc7e7536cb2e2ff6a8a647201533d57855ce3662)
- [Deleted Walker.cs.](https://github.com/TiLied/CSharpToJavaScript/commit/4cf908d7f50665ced2988ab4962a19d5369e9509)
- [Switch to the rewriters instead of a walker.](https://github.com/TiLied/CSharpToJavaScript/commit/b77238c16605c7c4ff2e4e1375b59ba6cd4a9673)
- [Rewrote a walker into 3 rewriters and 1 walker. The translated result should be more consistent.](https://github.com/TiLied/CSharpToJavaScript/commit/3e9eb08de7944648ec6d7e833e4384d767414558)
- [c# object -> js Object, c# string.Empty -> js String.raw``, c# List constructor -> js Array constructor](https://github.com/TiLied/CSharpToJavaScript/commit/b9d041647df2e326c036115f70fa81839a3018bc)
- [Updated attributes.](https://github.com/TiLied/CSharpToJavaScript/commit/b4e4827b9deba7371557f98154cbe86832172287)
**Full Changelog**: https://github.com/TiLied/CSharpToJavaScript/compare/0.1.10...0.2.0