tags:

views:

585

answers:

10

Does anyone know of a good lightweight IDE for .net? Often times I open VS and create a new project just to see if a line compiles, to test a quick method, or something trivial like that.

Essentially what I want is an app similar to notepad I can open, have the basic class structure already defined, and be able to compile/run it. It would be fine if it was always a console app.

A: 

I would check the C# Express Editions (If you are using C#). I leave it open with a basic console project already loaded. I just paste the code I want into that to quickly see if it compiles.

Kevin
+3  A: 

If you are not stick with C#, I'd recommend you to use F# interactive or IronPython console.

Vitaliy Liptchinsky
+1 awesome advice for testing assemblies etc on the fly. IronRUby is cute at that too :)
Perpetualcoder
+27  A: 

Snippet Compiler was created for you. It's incredibly useful and totally free!

And it's #1 on this very handy list!

Paul Sasik
Awesome tool for SO! ~
Pavel Minaev
That looks awesome! Never heard of it before. +1
Colin
You just beat me to the punch there... good call, I love this program.
Philip Wallace
Interesting that this hasn't come up on SO before. i thought the existence of Snippet Compiler was well known in .Net circles.
Paul Sasik
See my answer below, I've found a lot less friction using LINQPad over Snippet Compiler.
bdukes
A: 

I use command line (PowerShell these days) for that sort of thing, with a few .cs files lying around for common starting templates. Editor is whichever one is your favorite - it's Far+Colorer for me (with hand-tweaked syntax highlighting so that it understands all C# 3.0 and 4.0 keywords), but there are plenty other lightweight options.

Pavel Minaev
+13  A: 
Philip Wallace
+1 for the nice screen cap.
Paul Sasik
+3  A: 

just create a text file, save it as .cs and call the compiler from the command line, or create a batch file that takes the filename as parameter.

Here's the lowdown on the C# 2.0 compiler command line : MSDN article

Colin
A: 

SharpDevelop is pretty nice. I've not used it for C# (I mainly work on the OS stack) but I used it for small console IronPython program a couple of months back and it was a joy to work with.

Cruachan
A: 

Find an interpreter:

Or use notepad++ (or something similar) and make a script that runs the compiler.

egon
+7  A: 

Personally, I've run into a lot of friction using Snippet Compiler.

So, I tend to use LINQPad to test snippets. It's pretty convenient for testing individual lines of code, or most "full" program snippets, as well as evaluating LINQ statements against a database.

It features a really awesome view of results, so that complex types are displayed in an easy-to-read structure.

From their site:

  • LINQPad reports the execution time in the status bar, so you won't have to manually create a Stopwatch class for performance testing.
  • Want to test a variation of your snippet? Ctrl+Shift+C instantly clones your snippet so you can run another version side-by-side.
  • You can return to saved queries in single click, thanks to the My Queries treeview. Some people are using LINQPad as a scripting tool!

The only real snag that run into with LINQPad is in the "full program" mode (where you're defining methods, instead of just calling individual statements) you can't create extension methods, because everything happens inside of a the context of a hidden type (and extension methods can't be defined in a nested type).

bdukes
Nice find. i'm definitely going to try it out. Also seems like a great way to practice LINQ - important for a guy trying to get 3.5 from 2.0!
Paul Sasik
Interesting. +1 for introducing me to a new tool. Just to ask, what were the issues you had with Snippet Compiler? I have been using it for several years without any issues.
MagicAndi
I think the problems that I had were around including references/namespaces, and setting up supporting classes/methods outside of the Main method. However, it's been a while, so I don't remember the exact details.
bdukes
+2  A: 

By using the vsvars32.bat file provided by Microsoft, it only takes a minimal amount of configuration to run the C# csc.exe compiler from the command line.

So in general, any editor that can run a third party tool could be configured to run the C# compiler from within the editor.

jussij