English 中文(简体)
Visual Studio: c# interactive shell window
原标题:
  • 时间:2011-10-20 18:48:35
  •  标签:
  • c#
  • roslyn

Is there a way to use the C# interactive shell window (from the Roslyn CTP) outside of VS? Or is there something similar to it that is available?

最佳回答

After several years (ugh!) there is finally something in this space! CShell. From the site:

CShell is an interactive C# scripting environment. It allows you to use C# without any fluff right in a console like environment caled a read-eval-print-loop (REPL). Your code is directly evaluated and executed in a shell window, no separate executable has to be compiled and then run in a different process. More elaborate code can be written in a C# script and then evaluated as one file, only one line, or a selection. Then, your results can be easily dumped to HTML (like LINQPad) or viewed as a data grid or plotted to a chart.

问题回答

Right now, the interactive window only works inside Visual Studio. Roslyn exposes a scripting API which the interactive window uses, so you really want an interactive window running somewhere else, feel free to write it!

To be clear, the C# Interactive window uses several Visual Studio components (such as the VS Editor), so it cannot be hosted outside of VS. As Jason Malinowski said, you can create a quick-and-dirty Interactive window outside of VS pretty easily using the Roslyn Scripting APIs. Also, if you re looking to evaluate code outside of VS, you can create a C# Script file (.csx), add top-level code just as you can in the Interactive window, and run it with the rcsi.exe binary that ships with the Roslyn CTP.

Here is a quick Example, pretty minimal though. Don t support blocks {}

http://www.amazedsaint.com/2011/10/c-vnext-roslynan-introduction-and-quick.html

csi.exe is the command-line version of C# interactive. It s shipped in the box with Visual Studio. Type csi from a Developer Command prompt.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签