Software That Shines

Better Software Blog

Software Insights

Creating throwaway projects in Visual Studio

Quick tip: did you know you can easily create "throwaway" test projects in Visual Studio?

In Visual Studio settings, simply uncheck "Save new projects when created"

 'Save new projects' option

'Save new projects' option

By the way (bonus tip), you can easily find settings just by using the Quick Launch feature in the newer versions of Visual Studio (2012 and later):

VisualStudioQuickLaunch.png

Anyway, once you've done this, you can create a new project, give it a name, and worry about saving it later (if ever).  I use this all the time for testing out various experiments.

 Throwaway project

Throwaway project

Note that it doesn't work with all project types, unfortunately. 

 Some projects have to be saved

Some projects have to be saved

You can do a lot, but if you try to add an external reference, or another project, or a NuGet package, you'll have to save.  Otherwise, once you're done, when you close the solution, you'll be prompted whether to save it or throw it away:

 All done: save or discard?

All done: save or discard?


Depending on how simple the experiment is that you want to run, another possible testbed is the "C# Interactive Window" in recent versions of Visual Studio (2015 and later), accessible from the View menu (or use the Quick Launch!)

 C# Interactive, in the 'View' menu

C# Interactive, in the 'View' menu

 Simple example in the C# interactive window

Simple example in the C# interactive window

Anyway, hopefully this helps you in your programming experiments!  Knowing your tools well can save you a lot of time.

Mark SowulVisual Studio, Tips