CSharpToJavaScript 0.1.0
See the version list below for details.
dotnet add package CSharpToJavaScript --version 0.1.0
NuGet\Install-Package CSharpToJavaScript -Version 0.1.0
<PackageReference Include="CSharpToJavaScript" Version="0.1.0" />
<PackageVersion Include="CSharpToJavaScript" Version="0.1.0" />
<PackageReference Include="CSharpToJavaScript" />
paket add CSharpToJavaScript --version 0.1.0
#r "nuget: CSharpToJavaScript, 0.1.0"
#:package CSharpToJavaScript@0.1.0
#addin nuget:?package=CSharpToJavaScript&version=0.1.0
#tool nuget:?package=CSharpToJavaScript&version=0.1.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.
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."");"
};
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 },
...
};
...
Related Repository
- 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
| 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 (>= 4.14.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
**BREAKING CHANGE**
The library now has a single entry point, consumes a string and outputs a string. Refer to the README.
- CSTOJS now static.
- Added static method Translate.
- Deleted all GenerateOne* methods.
- [Added "TranslateFile" option](https://github.com/TiLied/CSharpToJavaScript/commit/d7896742bd0c12173b4fcd978b1bf08460ccd393)
- - Transferred "DisableConsoleColors" and "DisableConsoleOutput" to a Log.
- - Log now public.
- [Updated generated csharp.](https://github.com/TiLied/CSharpToJavaScript/commit/8ef8d736dfb0e5b96c6f919d4db5b328a65a1822)
- [Updated logging colors.](https://github.com/TiLied/CSharpToJavaScript/commit/89362fa8fbe927deb3621be14da412ed2f04cb28)
**Full Changelog**: https://github.com/TiLied/CSharpToJavaScript/compare/0.0.10...0.1.0