Advertisement

Renaming VC++ 6.0 Project Files

Started by July 27, 2000 08:39 PM
7 comments, last by milo 24 years, 4 months ago
Never needed to do this wholesale, but I want to rename a project, workspace, main file, etc., and leave most of the source code in their current files (new copy in the new project directory). Can''t seem to find any documentation and can''t seem to get it too work. You can''t rename within Visual Studio as far as I can tell. I know I can start a new workspace/project and add all the source files? But, that seems annoying. Is that the only way? Maybe, a utility out there in Web space somewhere. Mike Roberts aka milo mlbobs@telocity.com
I think making a new project is the only way to do it....

Great Milenko

Words Of Wisdom:
"Never Stick A Pretzel In Your Butt It Might Break Off In There."


http://www.crosswinds.net/~milenko
http://www.crosswinds.net/~pirotech

The Great Milenko"Don't stick a pretzel up your ass, it might get stuck in there.""Computer Programming is findding the right wrench to hammer in the correct screw."
Advertisement
Looks like I can do it by exporting the MAK file, editing the MAK file by hand, create a new Win32 Application project, and open the MAK file. Anyone ever do this? Does it work? I''ll probably know by the time you answer, but just in case...

Mike Roberts
aka milo
mlbobs@telocity.com
Just go in and edit all the project files that are text. Change all the occurances of the name you want to change. I do it all the time. It''s a piece of cake.
quote: Original post by Hootie
Just go in and edit all the project files that are text. Change all the occurances of the name you want to change. I do it all the time. It''s a piece of cake.
/quote]

Lets see there''s .aps, .dsw, .dsp, .plg, .ncb, and .opt.

.dsp''s are text, but nothing to alter the root path.

.dsw''s are text, but nothing to alter the root path.

.plg''s are html, but they are the build output file.

.aps''s, .ncb''s, are .opt''s, are not text.

Can you be more specific about what you do? Remember I don''t want to change just the filenames.

Mike Roberts
aka milo
mlbobs@telocity.com
Oops! Broke the quote.

Mike Roberts
aka milo
mlbobs@telocity.com
Advertisement
So basically you want to clone an existing project into a new directory, right?

So, simple:

1) copy everything under existing project directory to new directory.

2) using notepad or whatever change the project names in the .dsp & .dsw. All directories to source are stored as relative pathes so you don''t need to worry about them.

3) Rename all the .dsp, .dsw, etc files in the new directory to the new project name. Example: foo.dsp -> foo2.dsp

4) Open the new project''s workspace with Open Workspace menu option in VC++.

That''s it. Pretty simple.

quote: Original post by Hootie

So basically you want to clone an existing project into a new directory, right?

So, simple:

1) copy everything under existing project directory to new directory.

2) using notepad or whatever change the project names in the .dsp & .dsw. All directories to source are stored as relative pathes so you don''t need to worry about them.

3) Rename all the .dsp, .dsw, etc files in the new directory to the new project name. Example: foo.dsp -> foo2.dsp

4) Open the new project''s workspace with Open Workspace menu option in VC++.

That''s it. Pretty simple.


Close, but not quite. .ncb files are binary and contain non-relative paths. However, after a bit of trial an error, I found that you don''t copy that one across and it will be created anew with all the correct paths.

This is still quite tedious of a solution though for a large project with alot of changing to do. The MAK file solution would locate all the changes to be made into one file (except for renaming files, of course) if it works.

Thanks all.

Mike Roberts
aka milo
mlbobs@telocity.com





the .aps files are temporary files use by the resource editor and can be deleted. The resource editor will regenerate them.

The .dsw file is the work space file and can be edited to do what you need.
The .dsp file is the project file and is the file that you need to edit to change the project name, etc.

The .plg file is just a log of the last build and can be deleted. A new one will be generated the next time you build.

The .ncb file is use by the dev studio class browser and can be deleted. The class browser will rebuild the file from your source code if the file is not found. (If you have a corrupted project delete this file, it is most likely the culprit. Just a hint)

The .opt is machine specific options and can be deleted safely.

The .clw file exists if you are using MFC and is used by the class wizard. You can delete this file as well and the class wizard can regenrate it from your source files.

I have had to do exactly what you are asking quite a few times, and have actualy started modifying the .dsp files whenever I need to change almost any project options. If you learn how this file works, it can be very powerful. I like to use a project structure very different from what dev studio generates (source code and headers in a seperate directory, intermediate files in a dedicated directory seperate from the target directory, etc.) Modifying this file lets me use my structure without losing the benfits of the environment.

But before you modify the .dsw or .dsp, please back them up. If you modify the wrong thing, you can make the project unloadable, or worse, you can crash dev studio.


Edited by - bstach on July 28, 2000 11:30:03 AM

This topic is closed to new replies.

Advertisement