Sub directories within VS2008 projects are mainly used to physically represent on disk the namespace structure for the project. Each folder has a Boolean property called “Namespace Provider”, which when set to True causes ReSharper to validate that the physical location of a given class corresponds to the logical namespace location.
Occasionally I don’t want a folder to be used as a Namespace Provider, so I set this property to False, and ReSharper doesn’t perform the check.
This setting doesn’t get saved in the project file, and therefore reverts to the default value of True next time I open the solution. It’s not that big a deal but ReSharper does give you lots of warnings about incorrect namespaces.
Why doesn’t the property value get saved?
ReSharper 4.0 with VS2008 SP1
If you are adding a new class in your code then you may need to add the correspondence namespaces. To do it, you may either manually type the Using Namespace or you just right click on the class name and select Resolve > Namespace. But using “Ctrl+.” you can automatically add the namespace in your code.
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.
For me this setting is saved in a .csproj.resharper file. We have had problems because some developers add an ignore pattern on this file, and don't check it in.
@olivehour
This is a project-level setting that is saved in ProjectName.csproj.DotSettings file. Consider checking all project-level .DotSettings files to source control to persist this setting within your team.
Quick answer: Before switching branches, close the solution you are switching. This prevents VS from prompting you to "reload" the solution because it has changed. Visual Studio will remove ReSharper's custom settings in the .suo file when it reloads it.
Long answer: I have found that to persist the "Namespace Provider" False setting (True setting always persists because it is the default state) is to make sure that before I switch branches (via ToirtoiseSVN), I remember to close Visual Studio or the solution.
The state is cleared any time you choose the option to "Reload" Visual Studio after Visual Studio prompts you with the message: "The project 'project.name.here' has been modified outside the environment. Press Reload to load the updated project from disk. Press ignore to ignore the external changes."
I assume that this behavior occurs because Visual Studio strips out all unknown values from the .suo file when it reloads it. This is where this ReSharper setting (Namespace Provider) is persisted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With