A patched VB interactive that runs with stable releases of Roslyn.
Store page: https://www.microsoft.com/store/productId/9N210C9TDZ95?ocid=pdpshare
VBInteractive.sln
net8.0-windows
.Interactive\vbi
dotnet run --framework net8.0
dotnet run --framework net8.0-windows
dotnet run --framework net8.0 -- <path-to-vbx-file>
dotnet run --framework net8.0-windows -- <path-to-vbx-file>
vbi.rsp
/r:
to reference assemblies./imports:
to import namespaces and XML namespaces.vbi
with /?
option.The following code calls Newtonsoft.Json 13.0.3
stored in Windows NuGet package cache to serialize a number to JSON and prints the value in VB format.
#R "C:\Users\<your user name>\.nuget\packages\newtonsoft.json\13.0.3\lib\net8.0\Newtonsoft.Json.dll"
Newtonsoft.Json.JsonConvert.SerializeObject(1)
Prints a value in VB format.
The following code prints vbCrLf
or vbLf
depends on which OS you're using.
? Environment.NewLine
You can use Dim
, Sub
and Function
without wrapping them explicitly.
The following code prints Fibonacci sequence without declaring a class or module.
Function Fibonacci(n As Integer) As Integer
If n <= 1 Then
Return n
Else
Return Fibonacci(n - 1) + Fibonacci(n - 2)
End If
End Function
Sub PrintFibonacci(count As Integer)
Console.WriteLine(String.Join(",",
From i In Enumerable.Range(1, count)
Select Fibonacci(i)))
End Sub
Dim count = 10
PrintFibonacci(count)
Significant problems:
Imports
doesn't work in interactive mode.Await
can't be used in top-level code..vbx
files can't be run with the original version of Roslyn.For more information, see https://github.com/Nukepayload2/VBScriptDotNet/issues