Visual Studio: Zero-impact Projects & Cutting/copying empty lines

Yesterday I remembered two Visual Studio options Sara Ford told about in a presentation of her I attended a while back. Changing them made me happy… :)

Zero-impact projects
When I have to test something real quick, I tend to create a new project in Visual Studio and scribble some code to test whatever I want to test at that point. This causes my project directory to be filled with projects named ‘WindowsFormsApplication14’ or something like that. To make this stop, go to Tools – Options – Projects and Solutions – General. Uncheck the option ‘Save new projects when created’. This way those newly made (and shortly used) projects aren’t saved untill you explicitly tell Visual Studio to do so. No more ‘WindowsFormsApplication63’ for you! Unless you want to name it that way intentionally, of course…

Cutting/copying empty lines
We probably all experienced this at one time or another: you select some code, copy it, go to an empty line where you want to past the code…….and you press CTRL + C by accident. With the default settings, you just copied an empty line and have lost the stuff you copied earlier. But with this next option, empty lines won’t get copied or cut anymore! Go to Tools – Options – Text Editor – All languages (or just the language you want to change this setting for) and deselect the option ‘Apply Cut or Copy commands to blank lines when there is no selection’.

Visual Studio 2010: Close all documents

Sometimes it’s the little things that make you love a new product just a bit more.

I tend to close stuff I don’t use anymore fairly quickly. Sometimes I even close an Explorer window or an application right after I used it, only to find I need it again in a few moments… We all have our quirks, right ;)

While developing I regularly close all the documents I have open in Visual Studio, especially when I am done with a specific task. And most of the time, I like to collapse all the projects and their subfolders too to keep a tidy work environment. I also have the option ‘Track Active Item in Solution Explorer’ checked under ‘Tools’ – ‘Options’ – ‘Projects and solutions’ – ‘General’. Of course I have, I’d almost add…

In older versions of Visual Studio (while having the ‘Track Active Item in Solution Explorer’ option turned on) choosing the ‘Close all documents’ item in the ‘Windows’ menu after having collapsed all the projects lead to one project opening up again. That was the project with the document that was active just before closing all the documents. The ‘Track Active Item in Solution Explorer’ option seemed to squeeze in a ‘Look at that guy!’ just before all the documents actually closed, making Visual Studio open up the project and highlighting the file again. Although I knew this happened, I somehow kept to my usual routine of collapsing all the projects and their subfolders before closing all documents, with the same result each time: me closing that one project (or those seven subfolders) twice.

But…… no more in Visual Studio 2010! This newly built IDE seems to understand my way of work: no longer does Visual Studio (or the ‘Track Active Item in Solution Explorer option) open up the project of an active item when I choose ‘Close All Documents’. I’m not even sure if this was a specific choice or just a coincidental side-effect of the new IDE, but it makes me love Visual Studio 2010 just a bit more… :)

Visual Studio 2010 and the web.config

While working with Visual Studio 2010, a new feature caught my eye that isn’t communicated (strongly) in the “What’s new” lists you can find online. As part of the Visual Studio 2010 supports  multiple web.config files! Now we can create a separate web.config file for each configuration we have for our application. If you add a configuration through the configuration manager, you have the possibility to add a web.config file  for the new configuration too.

A web application gets two configurations by default: a Debug and a Release configuration. When opening the plus sign in front of the web.config file, two extra files appear: web.debug.config and web.release.config.  Depending on the active configuration, Visual Stusio selects the correct version.

The web.config file contains the default configuration. Configuration specific config files may add or remove settings or change current ones. This is done using simple transformation tags.

For more information on transformations have a look at: