There are times when I want to test new code from the forums or when I need to help my friends with specific C# problem. The problem is I don\'t want to create new \"project\" i
This is something I've never liked about visual studio. One thing (and probally the only thing) I miss from VB6 was the ability to create a project, and run it without saving it or anything. Was great for just what you said.
I typically have at least one or two scrap projects of each type, (Console, Winforms, and Web), that I just rotate and use. This way I'm not always creating new projects.
I just use the scratch console application project that I've defined for just this purpose. I cut out whatever is in the main program and go to town. If I decide that I need to keep whatever I've prototyped, I create a new project and copy to it. Since I do this all the time, the project's always in my recent-projects list, too.
I use a batch file (csc.bat):
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc %1 %2 %3 %4 %5 %6 %7 %8 %9
For vb.net I use this batch file(vbc.bat):
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\vbc %1 %2 %3 %4 %5 %6 %7 /r:system.windows.forms.dll /r:system.data.dll /r:system.dll
For example: C:>csc testit.cs
Each will create a .net .exe file. This solution is not so good for Windows Forms applications, however.
Check also Snippy and the Snippy Addin for Reflector
There is an online web C# compiler and executor: http://www.compileonline.com/compile_csharp_online.php
I usually use csc directly from the command line
C:\Users\Greg>csc /o- /debug+ Test.cs