10

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?

4

2 回答 2

24

您还需要确保更改项目属性中的默认命名空间,在更改程序集名称的位置旁边。ReSharper 在决定文件中的命名空间应该是什么时也使用它。

于 2013-04-30T07:58:31.087 回答
0

您将需要修改属性\元素在 .vbproj 或 .csproj 文件中。正如@citizenmatt所建议的那样。

拟议变更:

<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
 <PropertyGroup>
  <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  <ProjectGuid>{14E9B75E-02B5-4371-912F-674B7E199796}</ProjectGuid>
  <OutputType>Library</OutputType>
  <AppDesignerFolder>Properties</AppDesignerFolder>
  <RootNamespace>My.Default.Namespace</RootNamespace> //<-- Change this
  <AssemblyName>My.Assembly.Name</AssemblyName>
  <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
  <FileAlignment>512</FileAlignment>
</PropertyGroup>
于 2013-10-07T15:42:46.117 回答