更改项目名称,解决方案名称 [英] change project name,solution name

查看:157
本文介绍了更改项目名称,解决方案名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过以下步骤将项目名称从PROJECT APPLICATAION更改为教育板:

点击视图菜单上的项目单击属性窗口,在属性窗口中,我将项目文件更改为EDUCATION BOARD.and解决方案名称EDUCATION BOARD.but现在我的项目没有运行它仍然显示以前的URL和网站页面没有加载....请帮助...

i changed my project name from PROJECT APPLICATAION to EDUCATION BOARD by the following steps:
clicking on the project on the view menu clicked properties window and in properties window ,i changed my project file to EDUCATION BOARD.and solution name EDUCATION BOARD.but now my project is not running it still shows the former URL and website page does not load....help please...

推荐答案

如果您有一个搜索文件中文本的工具(例如免费的Notepad ++),那么您可以按照尝试重命名时的情况进行操作。使用Explorer打开项目文件夹。当你在那里确保你有一个你的解决方案备份



1.你改变属性项目文件后.csproj和.csproj.user文件重命名为Education Board.csproj和.csproj.user。您还将在Visual Studio的解决方案资源管理器中看到新项目名称。



2.现在转到项目菜单并选择教育板属性并更改Package / Publish Web和Default Namespace的值为新名称(请注意上面步骤5中有关空格的注释 - 对默认命名空间使用相同的名称)。这个错过的步骤可能是导致您出现问题的原因。


其余步骤是删除原始项目名称的所有痕迹......



3.打开.sln文件,您会注意到虽然解决方案文件包含新的.csproj引用,但它仍然引用原始文件夹名称。继续在资源管理器中重命名该文件夹(您应该在执行此操作时关闭Visual Studio)并编辑.sln文件以匹配新文件夹名称。



4。当您在适当的位置打开资源管理器时,转到新文件夹\ BIN文件夹并删除以Project Application开头的所有文件 - 可能是.dll,.dll.config和.pdb



5.现在导航到OBJ文件夹并删除Debug和Release子文件夹(如果存在)



6.重新打开在VS中的解决方案,看看你的一个cs文件 - 例如Startup.cs。请注意,命名空间仍然是原始名称。右键单击命名空间并重构,将命名空间重命名为新名称 - 它不会像空格那样使用Education_Board或EducationBoard



7.现在使用在Visual Studio中查找工具以搜索PROJECT APPLICATAION的所有实例并将其更改为教育板。你可能会在AssemblyInfo.cs中找到它们,也可能是Web.Config



8.最后一点整理 - 你可能有一个仍然保留的Repositories.config对旧项目名称的引用 - 您可以使用记事本对其进行编辑以删除有问题的行。您可能仍然可以在Education Board.suo文件中引用旧项目名称。只需删除该文件,当您退出Visual Studio时它将被重新创建。



就是这样......现在已经完成了对项目和解决方案的完全重命名。这是一个PITA不是它。



就个人而言,我通常只是创建一个新项目,将所需内容移植到我需要的地方,并从头开始重新创建项目。
If you have a tool for searching for text in files (e.g. Notepad++ which is free) then you can follow what happens when you attempt the rename. Open your project folder using Explorer. While you're there make sure you have a backup of your solution

1. After you changed the property "Project File" the .csproj and .csproj.user files are renamed to Education Board.csproj and .csproj.user. You'll also see the new project name in the Solution Explorer in Visual Studio.

2. Now go to the Project menu and select "Education Board Properties" and change the values for "Package/Publish Web" and "Default Namespace" to your new name (Note the comment about spaces in step 5 above - use the same name for the default Namespace). This missed step is probably what is causing your problem.

The rest of the steps are to remove all traces of your original project name...

3. Open up the .sln file and you will notice that although the solution file contains the new .csproj reference, it still refers to the original folder name. Go ahead and rename the folder in Explorer (you should close Visual Studio while you do this) and edit the .sln file to match the new folder name.

4. While you have explorer open in the appropriate place, go to the new folder\BIN folder and delete any files that start with "Project Application" - probably a .dll, .dll.config and .pdb

5. Now navigate to the OBJ folder and delete the Debug and Release sub-folders (if they exist)

6. Reopen the solution in VS and have a look at one of your cs files - e.g. Startup.cs. Note that the namespace is still the original name. Right click on the namespace and Refactor, Rename the namespace to your new name - it isn't going to like the spaces so use Education_Board or EducationBoard

7. Now use the Find facility in Visual Studio to search for all instances of "PROJECT APPLICATAION" and change them to Education Board. You'll probably find them in AssemblyInfo.cs and possibly Web.Config

8. Some last bits of tidying up - you may have a Repositories.config which still retains a reference to the old project name - you can edit this using Notepad to remove the offending line. You may still have a reference to the old project name in the Education Board.suo file. Just delete that file and it will be recreated when you exit Visual Studio.

That's it ... a full and complete rename of your project and solution has now happened. It's a PITA isn't it.

Personally I usually just create a new project, port the stuff across that I need and essentially recreate the project from scratch.


尝试更改所有文件中的名称而不仅仅是项目文件,但代码中的所有名称都将其更改为新名称
try to change the name in all file not just the project file but all name in code change it to the new name


这篇关于更改项目名称,解决方案名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆