'C# Interactive Location

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?



Solution 1:[1]

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.

Solution 2:[2]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Merilix2
Solution 2 Massaynus