5

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?

Brett Rowberry
  • 1,030
  • 8
  • 21
  • 2
    Most use Linqpad for these types of tasks. – s952163 Oct 16 '18 at 04:09
  • Scott Hanselman blogged about doing this with .NET Core. https://www.hanselman.com/blog/CAndNETCoreScriptingWithTheDotnetscriptGlobalTool.aspx – Wallace Kelly Oct 16 '18 at 12:57
  • 1
    I suggest you to look in `C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\csi.exe` – user4003407 Oct 18 '18 at 06:22
  • @PetSerAl please submit your comment as an answer so I can mark it as correct, that is add `C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn` to `PATH`. – Brett Rowberry Oct 18 '18 at 17:19

3 Answers3

6

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
user4003407
  • 21,204
  • 4
  • 50
  • 60
  • When I run that command, I get (**_1_**) _`C:\Program Files (x86)\MSBuild\14.0\Bin\csi.exe`_ & (**_2_**) _`C:\Program Files (x86)\MSBuild\14.0\Bin\amd64\csi.exe`_. Please, can anybody share what the advantages might be of choosing one over the other on my Windows 7 machine? **_EDIT_**: BTW, those are from an older VS installation (*VS 2010?*). I also have another more recent installation of _`csi`_ for VS2017 on a different volume. – deduper Nov 12 '18 at 13:09
  • Ah! OK. [_This answer_](https://stackoverflow.com/a/42601857/4465539) helped me to understand the need for VS _**2015's**_ 32 bit and 64 bit versions of _`csi.exe`_. – deduper Nov 12 '18 at 14:23
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.

Merilix2
  • 476
  • 4
  • 5
0

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

Massaynus
  • 322
  • 2
  • 9