Andy McCluggage
Andy McCluggage

Reputation: 38718

Why doesn't the "Namespace Provider" property get saved within a project file for a given subdirectory?

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.

Problem

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?

Versions...

ReSharper 4.0 with VS2008 SP1

Upvotes: 18

Views: 5757

Answers (3)

Jura Gorohovsky
Jura Gorohovsky

Reputation: 10148

@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.

Upvotes: 13

CodeDreamer68
CodeDreamer68

Reputation: 430

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.

Upvotes: 3

Robert Patterson
Robert Patterson

Reputation: 520

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.

Upvotes: 18

Related Questions