Skrypton 1.6.408
See the version list below for details.
dotnet add package Skrypton --version 1.6.408
NuGet\Install-Package Skrypton -Version 1.6.408
<PackageReference Include="Skrypton" Version="1.6.408" />
<PackageVersion Include="Skrypton" Version="1.6.408" />
<PackageReference Include="Skrypton" />
paket add Skrypton --version 1.6.408
#r "nuget: Skrypton, 1.6.408"
#:package Skrypton@1.6.408
#addin nuget:?package=Skrypton&version=1.6.408
#tool nuget:?package=Skrypton&version=1.6.408
Skrypton
Seamlessly migrate legacy VBScript to C# — translated into readable source and executed with identical runtime behavior.
Artifacts
| Name | nuget.org | GitHub Packages |
|---|---|---|
| Skrypton |
Background
VBScript is being retired. Microsoft has deprecated it and is removing it from Windows, which puts every classic ASP page, .vbs automation script, and MSScriptControl-hosted rules engine on a countdown. The obvious answer — "just rewrite it in C#" — is a trap, because VBScript's behavior is not the syntax on the page:
- Variants —
Empty,Null, andNothingare three distinct kinds of "no value", each with its own comparison and coercion rules. - ByRef by default — every argument is passed by reference unless declared
ByVal. On Error Resume Next— errors don't halt execution; they are swallowed and inspected later throughErr.- Late binding and default members —
obj,obj(0), andobj.Valuecan all resolve to the same call. - Literal-driven coercion — a comparison can behave differently depending on which side the literal sits on.
A hand rewrite silently changes these semantics, and the regressions surface in production. Skrypton exists to remove that risk: it translates VBScript to readable C# and ships a runtime support library that reproduces VBScript's semantics at execution time, so the generated code doesn't just look like the original — it behaves like it.
VBScript source ──▶ Skrypton ──▶ C# source ──▶ (Roslyn) ──▶ .NET assembly
│
└── references Skrypton.RuntimeSupport (the `_` compat layer)
Getting started
Skrypton targets netstandard2.0 and is built with the .NET 10 SDK (pinned in global.json). Install the NuGet package:
dotnet add package Skrypton
or build from source:
git clone https://github.com/benhauman/Skrypton.git
dotnet build Skrypton.slnx -c Release
There are three entry points, depending on how far you want to go:
| Goal | API |
|---|---|
| Inspect the C# a script becomes | DefaultTranslator.TranslateWithoutScaffolding(...) |
| Analyse a script's structure without translating | DefaultTranslator.Parse(...) → an ICodeBlock tree |
| Translate and run VBScript like the old COM engine | ScriptControlSupport.ScriptControlClass |
Translating a script
Given a small VBScript program:
Dim name
name = "World"
WScript.Echo "Hello, " & name
translate it to C# with DefaultTranslator. Any names that exist in the host environment (WScript, Request, Response, Session, …) are declared as external dependencies so the translator doesn't warn about them:
using System.Globalization;
using Skrypton.CSharpWriter;
using Skrypton.CSharpWriter.Lists;
string csharp = DefaultTranslator.TranslateWithoutScaffolding(
culture: CultureInfo.CurrentCulture,
scriptContent: vbscript,
externalDependencies: NonNullImmutableList<string>.Empty.Add("WScript"),
externalMemberMethods: [],
suppressions: []);
The generated program has a fixed shape. Outer-scope statements go into a Runner, global variables and functions into GlobalReferences, host objects into EnvironmentReferences, and each VBScript Class becomes a C# class:
namespace TranslatedProgram
{
public sealed class Runner : RunnerBaseT<EnvironmentReferences, GlobalReferences>
{
protected override void Go(...) { /* outer-scope statements */ }
}
public sealed class GlobalReferences : ... { /* global vars + functions */ }
public sealed class EnvironmentReferences : ... { /* WScript, Request, ... */ }
// ...translated VBScript classes
}
Every operation routes through the runtime support layer (referenced as _): _.ADD(a, b), _.CALL(...), _.IF(...), _.HANDLEERROR(token, ...). That layer is where Variant rules, error trapping, late binding, CreateObject, and the built-in functions actually live — which is why the translated code reproduces VBScript behavior rather than merely resembling it.
Compiling the generated code
The translated C# is ordinary source. Compile it with Roslyn (or dotnet build) against the Skrypton runtime assembly, which supplies RunnerBase, GlobalReferencesBase, EnvironmentReferencesBase, and the IProvideVBScriptCompatFunctionalityToIndividualRequests compat layer. The ScriptControl path (below) does exactly this in-process.
Hosting
ScriptControlSupport.ScriptControlClass is a managed drop-in for the MSScriptControl.ScriptControl COM component that legacy applications used to host VBScript. Instead of the retired scripting engine, it translates the added code to C#, compiles it with Roslyn, and executes it:
var control = new ScriptControlSupport.ScriptControlClass { Language = "VBScript" };
control.AddObject("Host", myHostObject, addMembers: true); // wired in as an EnvironmentReference
control.AddCode(vbscript);
control.ExecuteStatement("DoTheThing"); // translate → compile → run
Project status
Skrypton works for the translate-and-run path but is still under active construction. Honest status:
Working today
- Full VBScript front-end covering
If/ElseIf/Else,For/For Each,Do/While/Loop/Wend,Select Case,Class,Function/Sub/Property,Dim/ReDim Preserve/Const/Public/Private,Erase,Exit,On Error Resume Next/Goto 0,Randomize,With,Option Explicit. - C# code generation including the hard parts: ByRef aliasing (VBScript ByRef ↔ C# lambdas),
On Errortrapping, deterministicClass_Terminate→IDisposable, and literal-driven comparison coercion. - Runtime support library: Variant semantics, the full operator set, 100+ built-in functions, the VBScript error hierarchy, and late/
IDispatchbinding. ScriptControlemulation (AddCode/AddObject/ExecuteStatement) andParse(...)for structural analysis.
In progress
- The public
TranslateExecutable(...)entry point is commented out; onlyTranslateWithoutScaffolding(...)is exposed (the executable emitter is used internally by theScriptControlpath). - Several
ScriptControlmembers (Eval,Run,Reset,Modules,CodeObject,UseSafeSubset) areNotImplementedExceptionstubs. CreateObjectCOM activation is stubbed; register managed factories for the objects you need.- Internals still carry the upstream
VBScriptTranslator.*namespaces (see Credits).
Not there yet
- No CLI.
- No migration cookbook (see
todos.txtfor the running list of edge cases).
Syntax reference
How Skrypton maps the front-end pipeline and the language it accepts.
Pipeline
raw string
→ StringBreaker split out strings, comments, date literals
→ TokenBreaker break the rest into atoms (names, operators, braces…)
→ OperatorCombiner fold < + = into <= , collapse -- ++ runs
→ NumberRebuilder reassemble numeric literals ( .1 → 0.1 ), resolve .
→ CodeBlockHandler build an ICodeBlock tree (If / For / Class / Sub / …)
→ ExpressionGenerator (on demand) precedence-correct expression trees
Supported constructs
| Category | Constructs |
|---|---|
| Conditionals | If / ElseIf / Else, Select Case |
| Loops | For…Next, For Each, Do…Loop, While…Wend |
| Declarations | Dim, ReDim [Preserve], Const, Public, Private |
| Procedures | Function, Sub, Property Get/Let/Set (with Default) |
| Types | Class (incl. Class_Initialize / Class_Terminate) |
| Error handling | On Error Resume Next, On Error Goto 0, Err.Raise, Err.Clear |
| Statements | Set / Let, Call, Erase, Exit, Randomize, With, Option Explicit |
Built-in functions
100+ VBScript intrinsics, including type conversion (CInt, CLng, CDbl, CStr, CDate, CBool, Int, Fix), strings (Len, Mid, Left, Right, InStr, Replace, Split, Join, Trim, LCase, UCase), math (Abs, Round, Sqr, Rnd, Sgn), type tests (IsNull, IsEmpty, IsNumeric, IsObject, IsArray, TypeName, VarType), arrays (Array, LBound, UBound), date/time (Now, DateAdd, DateDiff, DatePart, FormatDateTime), and object/eval (CreateObject, GetObject, Eval, Execute, GetRef).
Project layout
src/Skrypton/
├── LegacyParser/ front-end stage 1: tokenizing + block parsing
├── StageTwoParser/ front-end stage 2: number/operator combining + expressions
├── CSharpWriter/ back-end: ICodeBlock tree → C# source
│ └── CodeTranslation/ scope tracking, block & statement translators
├── RuntimeSupport/ the `_` compat layer the generated code runs against
└── ScriptControlSupport/ managed MSScriptControl.ScriptControl replacement
Credits
Skrypton builds on the VBScriptTranslator project by Dan Roberts, which pioneered the parser, translator, and runtime-compat approach used here. It is reworked and extended under the same Apache-2.0 license.
License
Apache License 2.0 — © BENLENA.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.CodeAnalysis.Analyzers (>= 5.3.0)
- Microsoft.CodeAnalysis.CSharp (>= 5.6.0)
- System.Reflection.Metadata (>= 10.0.1)
- System.Text.Encoding.CodePages (>= 10.0.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Skrypton:
| Package | Downloads |
|---|---|
|
Skrypton.Windows
Skrypton on Windows (.NET): the Windows host services (processes, clipboard, dialogs, ADO through OLE DB, Outlook) and the script runner of the skrypton command line tool |
|
|
Skrypton.Windows.NetFx
Skrypton on Windows (.NET Framework 4.8): the Windows host services (processes, clipboard, dialogs, ADO through OLE DB, Outlook) and the script runner of the skrypton command line tool |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.7.90 | 27 | 11/20/2026 |
| 1.7.88 | 49 | 11/20/2026 |
| 1.7.78 | 127 | 11/13/2026 |
| 1.7.75 | 104 | 11/12/2026 |
| 1.7.72 | 105 | 11/12/2026 |
| 1.7.70 | 96 | 11/12/2026 |
| 1.7.63 | 104 | 11/12/2026 |
| 1.7.60 | 100 | 11/12/2026 |
| 1.7.51 | 100 | 11/12/2026 |
| 1.7.46 | 102 | 11/12/2026 |
| 1.7.20 | 109 | 11/11/2026 |
| 1.7.13 | 104 | 11/11/2026 |
| 1.7.8 | 105 | 11/11/2026 |
| 1.7.6 | 103 | 11/11/2026 |
| 1.7.4 | 99 | 11/11/2026 |
| 1.7.2 | 93 | 11/11/2026 |
| 1.6.408 | 134 | 7/17/2026 |
| 1.6.14 | 307 | 12/17/2025 |