Live Fast, Code Hard, Die Young

A really nice feature in Resharper 5 is the ability to adjust namespaces for code files in a directory. When you move files around in your project or between different projects the namespace no longer matches the directory structure. Updating the namespaces in the code files by hand is quite tedious and error prone. This is especially true when you move user controls or web pages that consists of a XAML file or ASP.NET page with a code behind class that needs to match.

You can adjust the namespace for all files in a directory by simply right clicking the folder in Visual Studio and select “Refactor->Adjust Namespaces…”:

image

This will give you the following dialog where you can see the changes that Resharper suggests:

image

Quite handy I think!

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: