简体   繁体   English

C# 互动定位

[英]C# Interactive Location

I use F# Interactive every day, so I like launching it from cmd, not just Visual Studio and Visual Studio Code.我每天都使用 F# Interactive,所以我喜欢从 cmd 启动它,而不仅仅是 Visual Studio 和 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 .为此,我的PATH中有一个名为FSHARPINSTALLDIR的环境变量,它指向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.这让我只需键入fsi即可启动 F# 交互。

Where is C# Interactive installed so I can do the same thing? C# Interactive 在哪里安装,所以我可以做同样的事情?

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.对于当前的 Visual Studio 版本 (15.8),C# 交互式控制台二进制文件应安装在相对于 Visual Studio 安装路径的MSBuild\\15.0\\Bin\\Roslyn\\csi.exe

IIRC, previous versions of Visual Studio install it under C:\\Program Files (x86)\\MSBuild directory. IIRC,以前版本的 Visual Studio 将其安装在C:\\Program Files (x86)\\MSBuild目录下。

You can use following CMD command to locate its actual location:您可以使用以下 CMD 命令来定位其实际位置:

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

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

type: where csi.exe输入: where csi.exe

On my specific installation, output is: Q:\VS2019\Community\MSBuild\Current\Bin\Roslyn\csi.exe在我的具体安装上,output是: 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.特定于您的 Visual Studio 安装的位置使其在生产环境中使用起来有点困难。

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"我刚到这里"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}"我从属性窗口中获取了目标命令,对我来说看起来像这样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)然后我把它打成这样的 bat 文件(我也做了一些清理)

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如果您有兴趣,这是个人资料

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM