https://github.com/microsoft/clearscript
A library for adding scripting to .NET applications. Supports V8 (Windows, Linux, macOS) and JScript/VBScript (Windows).
https://github.com/microsoft/clearscript
dotnet javascript v8 vbscript
Last synced: 12 days ago
JSON representation
A library for adding scripting to .NET applications. Supports V8 (Windows, Linux, macOS) and JScript/VBScript (Windows).
- Host: GitHub
- URL: https://github.com/microsoft/clearscript
- Owner: microsoft
- License: mit
- Created: 2017-05-04T12:02:05.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2025-03-21T23:54:25.000Z (about 1 month ago)
- Last Synced: 2025-04-08T10:11:37.967Z (14 days ago)
- Topics: dotnet, javascript, v8, vbscript
- Language: C#
- Homepage: https://microsoft.github.io/ClearScript/
- Size: 57.5 MB
- Stars: 1,859
- Watchers: 69
- Forks: 153
- Open Issues: 16
-
Metadata Files:
- Readme: ReadMe.md
- License: License.txt
- Security: SECURITY.md
Awesome Lists containing this project
README
[](https://microsoft.github.io/ClearScript/)
[](https://twitter.com/ClearScriptLib)
# Description
ClearScript is a library that makes it easy to add scripting to your .NET applications. It currently supports JavaScript (via [V8](https://developers.google.com/v8/) and [JScript](https://docs.microsoft.com/en-us/previous-versions//hbxc2t98(v=vs.85))) and [VBScript](https://docs.microsoft.com/en-us/previous-versions//t0aew7h6(v=vs.85)).# Features
* Simple usage; create a script engine, add your objects and/or types, run scripts
* Support for several script engines: [Google's V8](https://developers.google.com/v8/), [Microsoft's JScript](https://docs.microsoft.com/en-us/previous-versions//hbxc2t98(v=vs.85)) and [VBScript](https://docs.microsoft.com/en-us/previous-versions//t0aew7h6(v=vs.85))
* Exposed resources require no modification, decoration, or special coding of any kind
* Scripts get simple access to most of the features of exposed objects and types:
* Methods, properties, fields, events
* (Objects) Indexers, extension methods, conversion operators, explicitly implemented interfaces
* (Types) Constructors, nested types
* Full support for generic types and methods, including C#-like type inference and explicit type arguments
* Exposed .NET collections support native script iteration mechanisms:
* [](#) [`for...of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) and [`for await...of`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of)
* [](#) [`Enumerator`](https://docs.microsoft.com/en-us/previous-versions/visualstudio/visual-studio-2010/x32bxwys(v=vs.100))
* [](#) [`For Each...Next`](https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/scripting-articles/tywtbxd0(v=vs.84))
* Scripts can invoke methods with output parameters, optional parameters, and parameter arrays
* Script delegates enable callbacks into script code
* Support for exposing all the types defined in one or more assemblies in one step
* Optional support for importing types and assemblies from script code
* The host can invoke script functions and access script objects directly
* Full support for script debugging
* [](#) Support for fast data transfer to and from [JavaScript typed arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays)
* [](#) Support for [JavaScript modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)
* [](#) [](#) Support for [CommonJS modules](http://wiki.commonjs.org/wiki/Modules)
* [](#) Automatic conversion between .NET [`BigInteger`](https://docs.microsoft.com/en-us/dotnet/api/system.numerics.biginteger) and JavaScript [`BigInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt).
* [](#) Optional automatic conversion between .NET [`DateTime`](https://docs.microsoft.com/en-us/dotnet/api/system.datetime) and JavaScript [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).
* [](#) Optional automatic conversion between .NET [tasks](https://docs.microsoft.com/en-us/dotnet/api/system.threading.tasks.task) and JavaScript [promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
* Support for .NET 5.0+, .NET Framework 4.6.2+, .NET Core 3.1, and .NET Standard 2.1.
* Support for Windows (x86/x64/arm64), Linux (x64/arm/arm64), and macOS (x64/arm64).# Installation
### Complete package
All in one, for all supported platforms.[](https://www.nuget.org/packages/Microsoft.ClearScript.Complete)
### Composite packages
Everything you need for one platform.| Platform | Packages |
| :---: | --- |
| Windows | [&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+V2luZG93czwvdGl0bGU+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTAsMEgxMS4zNzdWMTEuMzcySDBaTTEyLjYyMywwSDI0VjExLjM3MkgxMi42MjNaTTAsMTIuNjIzSDExLjM3N1YyNEgwWm0xMi42MjMsMEgyNFYyNEgxMi42MjMiLz48L3N2Zz4=&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript) [&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHZpZXdCb3g9IjAgMCAyNCAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+V2luZG93czwvdGl0bGU+PHBhdGggZmlsbD0iI2ZmZiIgZD0iTTAsMEgxMS4zNzdWMTEuMzcySDBaTTEyLjYyMywwSDI0VjExLjM3MkgxMi42MjNaTTAsMTIuNjIzSDExLjM3N1YyNEgwWm0xMi42MjMsMEgyNFYyNEgxMi42MjMiLz48L3N2Zz4=&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript.win-arm64) |
| Linux | [&logo=Linux&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript.linux-x64) [&logo=Linux&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript.linux-arm) [&logo=Linux&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript.linux-arm64) |
| macOS | [&logo=Apple&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript.osx-x64) [&logo=Apple&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript.osx-arm64) |### Component packages
Cross-platform libraries and data.| Component | Packages |
| :---: | --- |
| Core | [](https://www.nuget.org/packages/Microsoft.ClearScript.Core) |
| JScript/VBScript | [](https://www.nuget.org/packages/Microsoft.ClearScript.Windows.Core) [](https://www.nuget.org/packages/Microsoft.ClearScript.Windows) |
| V8 | [](https://www.nuget.org/packages/Microsoft.ClearScript.V8) [](https://www.nuget.org/packages/Microsoft.ClearScript.V8.ICUData) |### V8 native assembly packages
Platform-specific V8 libraries.| Platform | Packages |
| :---: | --- |
| Windows | [&logo=V8&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.win-x86) [&logo=V8&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.win-x64) [&logo=V8&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.win-arm64) |
| Linux | [&logo=V8&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.linux-x64) [&logo=V8&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.linux-arm) [&logo=V8&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.linux-arm64) |
| macOS | [&logo=V8&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.osx-x64) [&logo=V8&logoColor=white)](https://www.nuget.org/packages/Microsoft.ClearScript.V8.Native.osx-arm64) |# Documentation
* [Main Site / Blog](https://microsoft.github.io/ClearScript/)
* [Examples](https://microsoft.github.io/ClearScript/Examples/Examples.html)
* [Tutorial](https://microsoft.github.io/ClearScript/Tutorial/FAQtorial.html)
* [API reference](https://microsoft.github.io/ClearScript/Reference/index.html)
* [Building, integrating, and deploying ClearScript](https://microsoft.github.io/ClearScript/Details/Build.html)# Acknowledgments
We'd like to thank:
* [The V8 team](https://code.google.com/p/v8/people/list).
* [The Jekyll team](https://jekyllrb.com/team/).
* [Kenneth Reitz](http://kennethreitz.org/) for generously providing the [`Httpbin`](http://httpbin.org/) service.
* [Michael Rose](https://mademistakes.com/) for generously providing the [So Simple](https://mmistakes.github.io/so-simple-theme/) Jekyll theme.
* [Toptal](https://www.toptal.com/) for generously providing the [Toptal JavaScript Minifier](https://www.toptal.com/developers/javascript-minifier).