CSharpToJavaScript 0.0.5

Additional Details

Use .Net 8 version(0.0.06+).
.Net 7 versions will soon be unlisted.

There is a newer version of this package available.
See the version list below for details.
dotnet add package CSharpToJavaScript --version 0.0.5
NuGet\Install-Package CSharpToJavaScript -Version 0.0.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CSharpToJavaScript" Version="0.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CSharpToJavaScript --version 0.0.5
#r "nuget: CSharpToJavaScript, 0.0.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CSharpToJavaScript as a Cake Addin
#addin nuget:?package=CSharpToJavaScript&version=0.0.5

// Install CSharpToJavaScript as a Cake Tool
#tool nuget:?package=CSharpToJavaScript&version=0.0.5


Brute forcing conversion(generating) from C# to Javascript.

This is a personal project with purpose to learn and understand better c# and js at the same time. Many stuff is not supported and some won't. Updates will be happening when I'm using this library.(irregular)

Nuget package

Try it online!


namespace ConsoleAppTest.CSharp;

public class Test							
	public Test()


class Test

How to use

  • 1 Create c# project or use existed one.
  • 2 Install nuget package or Download a specific version(visit releases) or Download a master(Code-Local-Download ZIP).
  • 3 Skip this if using Nuget package. Follow this to add reference to the project.
  • 4 In the Main method add:
CSTOJS cstojs = new();
await cstojs.GenerateOneAsync("FULL PATH TO CSHARP FILE YOU WHAT TO CONVERT");
  • 5 Run program and file will be generated in output path(default is "Directory.GetCurrentDirectory()") with name "|CS FILE NAME|.js"(default)
  • 6 See below for simple example "HelloWorld"

Example "HelloWorld"


using CSharpToJavaScript;
namespace ConsoleAppTest;

public class Program
	public static async Task Main()
		CSTOJS cstojs = new();
		await cstojs.GenerateOneAsync("C:\\GitReps\\ConsoleAppTest\\CSharp\\Test.cs");



using static CSharpToJavaScript.APIs.JS.GlobalObject;

namespace ConsoleAppTest.CSharp;

public class Test
	public Test()

Above code will generate "Test.js" file that contains:

class Test

More examples here. WIP!

Some Todos

CLI for library: https://github.com/TiLied/CSTOJS_CLI

Website/documentation: https://github.com/TiLied/CSTOJS_Pages

Thanks for packages and content ❤️

Microsoft CodeAnalysis CSharp nuget package

MDN-content for js docs

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

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.0.6 184 12/6/2023
0.0.5 111 9/27/2023
0.0.4 103 9/20/2023
0.0.3 102 9/14/2023
0.0.2 141 7/16/2023
0.0.1 142 7/6/2023

**!Breaking Change!**
**This update is mostly for CLI, Blazor WebAssembly and Extensions.**

- **Changed "GenerateOneFromStringAsync" to "GenerateOneFromString".**
- Deleted creation of debug.txt when Debug is enabled. Console output is enough.
- Added default references to the compilation.
- Added option "DisableConsoleOutput".
- Added detection for get only, auto implemented properties.
- Improved formatting and detection of the auto implemented properties.
- Small fixes.

**Full Changelog**: https://github.com/TiLied/CSharpToJavaScript/compare/0.0.04...0.0.05