How to tell ReSharper not to add certain namespaces
Hi all,
If I have a class Account in the Product.Data.XX namespace and I'm currently working in the Product.Data.YY namespace I could either write var foo = new XX.Account() or add the Product.Data.XX namespace to the list and just write var foo = new Account().
It seems like in the current version of RS it automatically adds the Product.Data.XX to the using list. What I would like is for RS to either ask me if I want that namespace (Product.Data.XX) in the using list (I almost never do) or just automatically NOT add it to the list. In previous versions I believe it would ask you what you wanted. The new version tries to be too helpful. I saw in the options a way to always keep certain namespaces, but not a way to never add one.
So, is there a way for me to have var foo = new XX.Account() and keep it that way? Right now I have to constantly fight RS by going and fixing the changes it makes.
Thanks,
Peter
Please sign in to leave a comment.
Hello Peter,
What ReSHarper version do you use? Are you talking about 8.0 EAP or 7.1.3?
Also, do you have any other VS or R# plugins installed?
Thanks.
Hi,
I'm using the latest 7.xx version. Besides R# I have installed "Microsoft Web Developer Tools", "NuGet Package Manager", "NUnit Test Adapter", "Spell Checker", and "Visual Studio Extensions for Windows Library for Javascript". However, this behavior happens in the regular C# files, it's definitely a R# behavior; these extensions should not conflict.
Thanks,
Peter
I'm in a similar situation. I have a number of packages/references to an object called “Contact”. 95% of the time I want the one that R# doesn't automatically insert so I end up having to delete it and then add the correct one. I'd love a “Never Add” namespace or a prompt to let me choose when more than one (assuming it knows).
I'm on the latest and greatest as of this writing :-)
Peter Smith, did you ever get a solution?
Hello Doug Dagworthy, thank you for your question. Currently, as a workaround, it is possible to force full type name qualification on import for particular types in
(Extensions) | ReSharper | Options | Code Editing | Type Import
. Also, there is the following issue in our bug tracker about this. Please comment or vote for it to get notifications about status changes.