C# Interactive Location

2.1k Views Asked by At

I use F# Interactive every day, so I like launching it from cmd, not just Visual Studio and Visual Studio Code. To do that, I have an environment variable called FSHARPINSTALLDIR in my PATH that points to C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\FSharp. This allows me to simply type fsi to launch F# interactive.

Where is C# Interactive installed so I can do the same thing?

3

There are 3 best solutions below

2
user4003407 On BEST ANSWER

With current Visual Studio version (15.8) C# interactive console binary should be installed in MSBuild\15.0\Bin\Roslyn\csi.exe relative to Visual Studio installation path.

IIRC, previous versions of Visual Studio install it under C:\Program Files (x86)\MSBuild directory.

You can use following CMD command to locate its actual location:

dir "C:\Program Files (x86)\csi.exe" /s /b
0
Massaynus On

I think I found a good solution

  1. i just went here "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2019\Visual Studio Tools"

  2. I took the target command from the properties window wich for me looked something like this C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -noe -c "&{Import-Module """C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"""; Enter-VsDevShell ee278031}"

  3. and the i slapped it into a bat file like this (I've done a bit of cleanup too)

powershell.exe -noe -c "&{Import-Module """C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"""; Enter-VsDevShell ee278031}; cd ~; clear; echo 'Welcome back Massaynus!'"

  1. I managed to make this into a profile in microsofts new terminal and it works like butter

Here is the profile if you are interested

0
Merilix2 On

Open Startmenu/Visual Studio 2019/x64 Native Tools Command Prompt for VS 2019

type: where csi.exe

On my specific installation, output is: Q:\VS2019\Community\MSBuild\Current\Bin\Roslyn\csi.exe

The location specific to your Visual Studio installation makes it a bit difficult to use in production environment.

Related Questions in F#