Skip to content

Instantly share code, notes, and snippets.

@Beej126
Forked from noseratio/csharp-repl.ps1
Created April 18, 2022 04:07
Show Gist options
  • Save Beej126/6ccaf84aa1fccb584e3bbf88fbc1a8da to your computer and use it in GitHub Desktop.
Save Beej126/6ccaf84aa1fccb584e3bbf88fbc1a8da to your computer and use it in GitHub Desktop.
C# REPL with Microsoft.Net.Compilers.Toolset
# https://www.nuget.org/packages/Microsoft.Net.Compilers.Toolset
md cs-repl | cd
nuget install Microsoft.Net.Compilers.Toolset
# run a CS script, a useful alternative to PowerShell itself
echo 'Console.WriteLine("hello");' > script.csx
. (gci -recurse csi.exe).FullName script.csx
# run in REPL mode
. (gci -recurse csi.exe).FullName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment