Col*_*nic 29 .net c# visual-studio fsi roslyn
F#有一个REPL(读取 - 评估 - 打印循环)F#Interactive , C:\Program Files (x86)\Microsoft F#\v4.0\Fsi.exe.
据我所知,C#现在有自己的交互式REPL,与Roslyn一起发布.如何在Visual Studio外部打开?在哪里csi.exe?
Din*_*ruz 15
我创建了你要求的东西,一个在VisualStudio之外运行的基于Roslyn的REPL.
您可以从PoC下载它- Roslyn C#ScriptEngine Execute v1.0.exe,它是一个独立的exe,包含所有Roslyn程序集作为嵌入式资源.另请参见视频:使用O2基于Roslyn的C#REPL脚本环境
请注意,我为O2平台开发了更强大的C#REPL ,您可以从C#REPL脚本环境中查看和下载
关于Roslyn的主题,我创建了许多其他独立工具:
请注意,所有这些工具和O2平台都是在开源许可下发布的,所以请随意扩展并使它们更好:)
Ath*_*ari 15
C#Interactive窗口和csi.exe REPL被添加到Visual Studio 2015 Update 1(强调我的):
介绍互动
交互式窗口又回来了!C#Interactive窗口返回Visual Studio 2015 Update 1以及其他一些交互式处理:
C#互动.C#Interactive窗口本质上是一个read-eval-print-loop(REPL),允许您使用.NET技术进行游戏和探索,同时利用IntelliSense,语法着色等编辑器功能.了解有关如何使用C#的更多信息在第9频道互动或阅读我们的初学者演练.
csi.如果您不想打开Visual Studio来使用C#或运行脚本文件,则可以从Developer Command Prompt访问交互式引擎.键入
csi /path/myScript.csx以执行脚本文件或键入以简单csi地插入命令行REPL.脚本API.Scripting API使您能够在主机创建的执行环境中执行C#代码片段.您可以通过查看我们的代码示例来了解有关如何创建自己的C#脚本引擎的更多信息.
请参阅.NET Managed Languages的Visual Studio 2015 Update 1中的新增功能.
https://www.visualstudio.com/en-us/news/vs2015-update1-vs.aspx
>csi
Microsoft (R) Visual C# Interactive Compiler version 1.1.0.51109
Copyright (C) Microsoft Corporation. All rights reserved.
Type "#help" for more information.
> #help
Keyboard shortcuts:
Enter If the current submission appears to be complete, evaluate it. Otherwise, insert a new line.
Escape Clear the current submission.
UpArrow Replace the current submission with a previous submission.
DownArrow Replace the current submission with a subsequent submission (after having previously navigated backwards).
REPL commands:
#help Display help on available commands and key bindings.
Script directives:
#r Add a metadata reference to specified assembly and all its dependencies, e.g. #r "myLib.dll".
#load Load specified script file and execute it, e.g. #load "myScript.csx".
>
> Enumerable.Range(10)
(1,12): error CS7036: There is no argument given that corresponds to the required formal parameter 'count' of 'Enumerable.Range(int, int)'
> Enumerable.Range(1, 10)
RangeIterator { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }
Run Code Online (Sandbox Code Playgroud)
如果您使用的是 dotnet 核心,请尝试使用 dotnet-script。
运行dotnet tool install --global dotnet-script安装。然后运行dotnet-script得到一个 REPL 风格的命令提示符
> Console.WriteLine("Hello world!");
Hello world!
Run Code Online (Sandbox Code Playgroud)
我找到的唯一可执行文件是C:\Program Files (x86)\Microsoft Codename Roslyn CTP\Binaries\rcsi.exe,它可以执行.csx文件.但它似乎并没有真正支持REPL.
| 归档时间: |
|
| 查看次数: |
9497 次 |
| 最近记录: |