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.
- 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."");" }; FileData[] files = CSTOJS.Translate([ file ]); Console.WriteLine(files[0].TranslatedStr);
- Run a program
- Console output should be:
console.log("Hello world.");
FileData file = new() { OptionsForFile = new(){ Debug = true }, ... }; ...
- Dotnet tool/CLI for a library: https://github.com/TiLied/CSTOJS_CLI
- 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