Tag Archives: visual studio

The File Nesting extension in Visual Studio 2013 Ultimate

If you don’t know about the File Nesting extension from Visual Studio, watch the demo video on Channel9. It’s a very nice productivity tool.

After installing the File Nesting extension in Visual Studio 2013 Ultimate, right-clicking and nesting individual files worked, but right-clicking on, e.g., the Scripts folder and selecting File Nesting -> Auto-nest selected items did nothing.

Flummoxed, I had a peek in Tools -> Options, and lo and behold, there is a settings page for File Nesting. By default, all of the rules were disabled. Once I tweaked the options, auto-nesting started working as expected.

Setting these options to true made auto-nest work for me.

Setting these options to true made auto-nest work for me.

Just a little tip that will hopefully save you some headaches.

Unable to start debugging on the web server

If you’re getting this error when trying to debug an ASP.NET Web application on IIS7 or greater, check the system.webServer element in your Web.config.  If you have the httpErrors element configured, you won’t be able to debug.  For your local dev environment, remove or comment out the httpErrors element, and you should be good to go.

From my ASP.NET 1.1 days, I have a hazy memory of Visual Studio’s debugging startup process requesting a bogus URL on the target Web site, and then doing something with the 404 response prior to launching the debugging session.  Obviously, if it’s expecting a 404 or the page to contain certain text, redirecting to an error page will prevent you from launching the debugger successfully.

If you happen to know specifically why this happens, please leave a comment (or contact me if comments are closed), and I will gladly update this entry.

Organize Usings

In Visual Studio 2008, when you add a new Web form to your project, the "using" section of the code-behind contains a lot noise:

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

You may very well need some of those namespace declarations, but odds are high that you don't need them all.  But which ones can you remove without breaking your page?

Visual Studio has a nice feature called Organize Usings, which you access by right-clicking anywhere in the code-behind page.  The menu looks like this:

Organize Usings Menu

When you click on "Remove and Sort", it removes any unused "using"s and sorts those that remain. 

So now, instead of the mess that we had before, we have a much cleaner "using" section in our source code file:

using System;

Pretty slick, huh?