Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent ReSharper from shortening namespaces when adding using directives?

When I use ReSharper to add a using directive (using Alt+Enter) it removes "unnecessary" parts of the namespace. I prefer using the full namespace which is also the behavior of Visual Studio.

Example:

namespace MyCompany.MyTool.Data
{
    // This is what ReSharper gives me:
    using Core;

    // This is what I want:
    using MyCompany.MyTool.Core;

    // ...
}

Which setting do I have to change in ReSharper 4.5 so it uses the full namespace?

like image 950
Albic Avatar asked Dec 26 '09 22:12

Albic


People also ask

How to change namespace name in c#?

You could put the caret on a namespace declaration in your C# code and press F2 on the keyboard. This should let you change the name of the namespace across the entire project, including the XAML files.

How do I refactor namespace in Visual Studio?

Place your cursor in the namespace name. Press Ctrl+. to trigger the Quick Actions and Refactorings menu.

How do you change the namespace of a project in Visual Studio?

You can change the default namespace: -> Project -> XXX Properties... Instead of Find/Replace, you can also right click the namespace in code and Refactor->Rename. my Default Namespace textbox in project properties is disabled.


1 Answers

I don't have ReSharper 4.5 installed at the moment, but in 5.0 there's an option at the Namespace Imports pane called Prefer fully qualified using name at nested scope. It might be the one you're looking for.

like image 187
Igal Tabachnik Avatar answered Sep 19 '22 10:09

Igal Tabachnik