I'm writing .csx build scripts. On my local machine I run them with CSharp interactive from visual studio or via C:\Program Files (x86)\MSBuild\14.0\bin\csi.exe
. I've tried running .csx scripts on a TeamCity build agent machine (agent machines perform actual build tasks like compilation), which has Microsoft Built Tools 2015 installed. Surprisingly, there was no csi.exe
in MSBuild folders.
I'm looking for a way to install csi.exe
or a compatible standalone .csx runner on my build agent machines. The options found in Google, like https://github.com/cake-build/cake , all seem to have their distinct flavor of scripts or lots of additional functionality, whereas I'm looking for a csi.exe
clone ideally.
Scripting engineC# can be used as a scripting language using the compiler services from Roslyn. This has existed since Visual Studio 2015 Update 1. Canonically C# script files have been written with a . csx extension.
c:\Program Files (x86)\Microsoft Web Tools\Packages\Microsoft. Net. Compilers. X.Y.Z\tools\csi.exe.
Developer file written in Visual C# Script, a C# API developed by Microsoft under the codename The Roslyn Project; used for developing components in C# that can run on-demand as scripts with the Roslyn framework. The Roslyn program that runs CSX files as scripts is named rcsi.exe.
Solution turned out to be easy: Roslyn NuGet package contains csi.exe.
It will be located at packages\microsoft.net.compilers.2.4.0\tools\csi.exe
.
One thing to note - installation script for the package changes .csproj
file to use the compiler provided by the package. This is likely not what you want, so make sure to roll-back such changes if they are made during installation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With