Visual Studio temporary projects

Does ConsoleApplication87 sounds familiar to you? If so, I’ve got some great news for you – a tip that will help you keep your disk clean of all the test code that you check out.

Imagine: you’re in the middle of the development process working on SharePoint code. Then you would like to check out some code before including it in the solution and rebuilding the whole thing. You fire up a new instance of Visual Studio and create a test project. Visual Studio spins for a second and comes up with a unique name: ConsoleApplication87. ‘What are the previous 86?’ – you’re starting to wonder…

I do it every day: I’m working on something and would just like to check out a piece of code. Creating a temporary Console Application takes just a second and somehow I never really care about deleting it once I’m done. While you could schedule a “maintenance” job or just do it once in a while manually, there is a little gem in Visual Studio just for that – working with one-time projects.

Open Visual Studio. Go to Tools > Options > Projects and Solutions > General. Go on and uncheck the Save new projects when created option.

Visual Studio options dialog with the ‘Save new project when created’ option focused

The next time you will create a project, a little different dialog will appear (notice there is no Location textbox):

‘New Project’ dialog without the Location textbox

A temporary project is being created in the ‘C:\Users\<User>\AppData\Local\Temporary Projects’ folder. You can now test and build any kind of code you want and once you’re done Visual Studio will kindly ask you if you want to save the project for future reference or just discard it. If you decide to discard it, Visual Studio will delete the project’s folder and all the files in it, leaving not a single trace on your hard drive.

Temporary Projects are a cool feature that keeps you productive and doesn’t fill your hard drive. Although I’ve used Visual Studio 2010 for the screenshots, the option is also available in the previous versions.

Technorati Tags: Visual Studio


comments powered by Disqus