1

我为自己做了一个非常大的项目,最近一个客户要求他们自己的版本进行一些修改。项目名称相当愚蠢,我的客户想要源代码,所以我认为最好将所有文件重命名为

sillyname.h
sillyname.cpp
sillyname.dsp 

等等。不幸的是,在我将所有内容重新添加在一起之后,我看不到任何更改项目名称本身的方法。另外,现在我在编译时遇到了这个错误。

main.obj : error LNK2001: unresolved external symbol __imp__InitCommonControls@0
Debug/New_Name_Thats_not_so_silly.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

必须有一种更简单的方法来改变这一切,对吧?

4

5 回答 5

3

Here is a Step by Step on Steve Andrews' blog (he works on Visual Studio at Microsoft)

于 2008-09-26T20:46:03.353 回答
1

I haven't verified this, but I've done this a number of times and if my memory serves me right, you can actually use the search-and-replace functionality in VS2005 to rename all instances of the string "X" to "Y" in any type of file. Then you need to close the solution and change the project (and any other file with the same name regardless of extension) file name(s).

You will obviously need to do a full rebuild afterwards.

于 2008-09-26T20:55:25.923 回答
1

我发现手动执行此操作也总是很烦人。

所以我尝试了一些通过谷歌搜索可用的工具 - 两个不起作用(这里是 VS C++),不知道,如果它们对 C# 更有用。

以下工具对我很有用:我使用了试用版,但我会为此支付 39 美元。对我来说这是值得的。它还有一个 VS 插件。不直接支持 VS 2013,至少没有提到,但是,当我查看时: http ://www.kinook.com/CopyWiz

就地重命名不起作用(访问错误),但“复制时重命名”工作正常。

但我真的很想知道,它是否像某些程序员声称的那样困难。对于大多数部分文件重命名和搜索和替换项目目录中所有文本文件中的所有出现应该是一种非常简单且有效的方法。也许有人可以贡献如此困难的事情。

我大脑的理性部分禁止做梦的部分编写自己的工具——我很幸运!:-)

于 2013-08-20T13:39:48.823 回答
0

I assume that in addition to the renamed set of files, you also still maintain a complete "parallel" set of the original files in some other directory, am I right?

Assuming you have both versions, what I would do is:

Get a file comparison tool like Beyond Compare or DiffMerge and compare the old SLN file and the new SLN file side-by-side. Also do this for each "proj" file and any other "config" type files.

It is possible to edit these files by hand. Usually looking at what is different between two copies will help illuminate what you should do to get the second one working.

You might as well start tinkering with the renamed project by hand, anyway, given that it already isn't working. You can't make it much worse. And: you might learn some handy tricks about the XML structure of these files.

Even if you do make small mistakes when hand-tweaking this files, I have repeatedly been very impressed by how Visual Studio handles things. Visual Studio will usually tell you exactly where you got it wrong.

于 2008-09-26T21:01:08.717 回答
0

您可以简单地重命名 .vcproj 或 .dsp 文件,然后创建一个新工作区 (sln dsw) 并包含重命名的项目,或者只是在 sln 文件中更改名称(它只是 xml)我不记得格式旧工作区,但它仍然是文本。

您可以手动重命名并重新包含编辑项目文件的所有 .cpp 并在其中重命名它们。

抱歉,不知道可以完成所有这些的重构工具,但可能有一个。

于 2008-09-26T20:40:22.260 回答