5

Is there C# interactive window for VS 2013, or any other similar way, without installing VS 2012. I tried C# Repel, C# Snippet Compiler and Mono Command Prompt, but, all of them don't provide the features of C# interactive window packed with Roslyn for VS 2012.

3
  • 1
    Keep track of this thread social.msdn.microsoft.com/forums/vstudio/en-US/… I guess when something comes out it will appear there first.
    – kzfabi
    Jul 7, 2014 at 14:51
  • I've already found that article... Wasn't there any official announcement?
    – IWIH
    Jul 7, 2014 at 18:06
  • 1
    No that I'm aware of.
    – kzfabi
    Jul 7, 2014 at 22:13

6 Answers 6

5

UPDATE: Found a total better alternative!!! Try CShell, it is free and open source! "A simple, yet powerful, C# scripting IDE" as they promote it. Check my tweet which was also favorited by Scott Hanselman :)

My old recommendation was: LINQPad

4
  • It appears to be for SQL queries only, doesn't it?
    – IWIH
    Jul 7, 2014 at 18:05
  • No, it works with everything you want of the language. Check the docs. You can even import your own assemblies to use just like Roslyn.
    – kzfabi
    Jul 7, 2014 at 22:12
  • Indeed, it's not exactly interactive, you write your code then run it... not working interactively.
    – IWIH
    Jul 23, 2014 at 23:25
  • 1
    Just for other readers: past comments were talking about LINQPad, not CShell.
    – kzfabi
    Sep 15, 2014 at 14:51
2

Best way is to install VS 2012 and use C# interactive window provided with its Roslyn. While doing that, wait Microsoft to release C# interactive to VS 2013.

3
2

This is taken from one of the links above: http://social.msdn.microsoft.com/forums/vstudio/en-US/0da45fe7-fbe2-4074-b52f-dc8d7c4b2ba3/c-interactive-in-vs-2013

It worked for me, so hopefully this will help the next person :)

Hi SpencerGR,

I just got upgraded to VS 2013 and wanted C# Interactive, and this is the first hit when I searched for it, so I figured I would place my answer here...

Didn't make sense to me that the extension from VS 2012 wouldn't work; so I hunted down the Roslyn keys in my registry for VS 2012 and was able to kinda figure out what was going on. After a bit of futzing around, I finally got it working, so here's the instructions for whoever might care to try [be warned, I'm sure this isn't supported by MS, I take no responsibility if something happens to mess up your computer, and so forth ;)].

Basically it was a matter of

copying some registry keys with slight modification copying some files and this one is annoying but oh, well] there's a file you have to change the datestamp on (I did it by opening the file in Notepad++ and saving it out.) If you don't already have VS 2012 or you don't have the Roslyn CTP installed you'll need to get the files somehow, and I'm not sure if there are other registry settings needed or not, but I imagine if you just manage to get the files out of the CTP distro it would be enough... No guarantees of course.


Not-Instructions-Just-An-Explanation-Of-What-I-Did-I-Am-A-Trained-Professional-...-Or-Something ;)

  1. copying some registry keys with slight modification; I replaced '11.0' with '12.0' in the keys and values, you might need to change the paths too if you didn't install Visual Studio in it's default location. (also posted to pastebin.com/XeP5ai8F )

Save this as a .reg file and open it to import the new keys easily:

Windows Registry Editor Version 5.00.

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\InteractiveWindows\0] "ContentType"="Roslyn C#"

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\InstalledProducts\Roslyn] ""="Microsoft Roslyn CTP" "ProductDetails"="Microsoft Roslyn CTP"

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Packages\{c5edd1ee-c43b-4360-9ce4-6b993ca12897}] "Class"="Roslyn.VisualStudio.CSharp.Repl.CSharpReplPackage" "CodeBase"="C:\\Program Files (x86)\\Microsoft Visual Studio
12.0\\Common7\\IDE\\Extensions\\Microsoft\\Roslyn C# Interactive Window\\1.2.20906.1\\Roslyn.VisualStudio.CSharp.Repl.dll"

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Packages\{f5199a4e-6a60-4f79-82e9-fc92a41c4610}] "Class"="Roslyn.VisualStudio.InteractiveWindow.InteractiveWindowPackage" "CodeBase"="C:\\Program Files (x86)\\Microsoft Visual Studio
12.0\\Common7\\IDE\\Extensions\\Microsoft\\Roslyn Components\\1.2.20906.1\\Roslyn.VisualStudio.InteractiveWindow.dll"

[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\ToolWindows\{2d0a56aa-9527-4b78-b6e6-ebe6e05da749}] "Name"="Roslyn.VisualStudio.InteractiveWindow.VsInteractiveWindow"
  1. copying some files; basically just need to copy the files mentioned above to the locations mentioned above; I just copied the 'Common7\IDE\Extensions\Microsoft\Roslyn C# Interactive Window' and 'Common7\IDE\Extensions\Microsoft\Roslyn Components' folders from my 11.0 install to my 12.0 install. easy peasy.

  2. and yeah... there's a file in the aforementioned 'Common7\IDE\Extensions' directory called 'extensions.configurationchanged'; I couldn't get things to take, then I noticed that file. so, as mentioned, I just opened in Notepad++ and saved back out; I think I had to make a change to the file, so I added a space. kinda felt kludgy, but I guess it beats VS taking longer to load due to having to scan the Extensions every time you open it up.


So, that's it! Worked for me, I hope someone else may find this useful, as it probably took longer to post this than it did to actually get it working in the first place. ;) It's possible I missed a step in here somewhere, since I had made a few other attempts before I found the 'changed' file, so I could have possibly twiddled another bit somewhere that was necessary that I don't remember. Should be a good start tho.

I haven't tested it out fully by any means but it shows up in the 'View > Other Windows' list, it opens up just find, and it looks like Intellisense is working too. Good luck and great code to all! :)

--- Chelle L.

1
  • I've managed to run this in VS 2013, but not in VS 2015, have you tried it in VS 2015? Aug 25, 2015 at 14:33
2

You could also use LinqPad. You can use it to test C# code. It has built in support for loading DLLs and Nuget Packages. Its what I use personally and I love it.

It has a free version, but the paid version has intellisense and debugger

2

C# interactive finally arrived to VS 2015... You may need to install vs2015.1 to get it..

http://blogs.msdn.com/b/visualstudio/archive/2015/10/08/visual-studio-2015-update-1-ctp.aspx

Good luck... and happy interactive coding!

1

IWIH describes how to install it and which prerequisites you need.

Let me give you some

Additional information:

After you have installed VS 2015 and its updates (update 3 KB3165756 patch has just arrived) you can bring C# interactive to your screen as follows:

Either via the menu

View -> Other Windows -> C# Interactive

Or press Ctrl + Q and type into the quick launch box:

C# interactive

which allows you to click on View -> Other Windows -> C# Interactive with the mouse.

Afterwards, you have the C# Interactive beneath the error list. Here is an example how you can use it:

enter image description here

Quickstart:

  • To get help in this window, type #help and press enter.
  • To execute a statement, simply press ENTER. To type in multiple lines, press SHIFT+ENTER for each line, and for the last line press ENTER to execute the entire statement.
  • To print the values of a variable, type its name and press enter (in the screen shot, I have done this for variable q)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.