Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resharper keeps complaining that a namespace doesn't correspond to file location even though it does

I am working on a WCF project. The name of the project used to be ServiceTemplate and I have decided to change it to something more indicative. I have done the somewhat painful job of renaming the project according to the following steps:

  • Change the namespaces in accordance with the new project name. This step has expectedly caused Resharper to complain that the namespaces don't correspond to their file location and suggested to change the namespace to "ServiceTemplate.Something". I ignored the warning because it is supposed to disappear later.

  • Use find-and-replace to replace all the occurences of "ServiceTemplate" in the entire solution.

  • Close the solution.

  • Rename the ServiceTemplate folder and the ServiceTemplate.csproj file.

  • Open the sln file with notepad and repeat the ugly process of find-and-replace to replace all the occurences of "ServiceTemplate" in that file.

Even after all these steps, Resharper still complains the namespaces don't correspond to the file location. Strangely, Resharper still suggests changing the namespace to "ServiceTemplate.Something" even though the string "ServiceTemplate" is nowhere in the solution, neither in folder/file names nor in file contents.

What could've caused the problem and how do I get rid of it?

like image 719
snakile Avatar asked Apr 30 '13 07:04

snakile


1 Answers

You also need to make sure you change the default namespace in the project properties, next to where you change the assembly name. ReSharper also uses this when deciding what the namespace in a file should be.

like image 68
citizenmatt Avatar answered Sep 17 '22 20:09

citizenmatt