Click here to Skip to main content
15,890,391 members
Articles / Desktop Programming / MFC
Article

Renaming a workspace - .dsp and .dsw

Rate me:
Please Sign up or sign in to vote.
3.90/5 (7 votes)
28 Mar 20033 min read 102.7K   821   20   20
A hack to rename a workspace (MSVC6 only).

Image 1

Preliminaries

The ideas and discussions in this article are only relevant if your programming environment is MSVC6 or if you have some MSVC6 workspace project lying around that you are intending to give it a new name. Sample executable uploaded (src update pending).

Introduction

At certain point during a project's implementation cycle, I found myself, in many instances, writing code that is ideal to serve as a base framework for new applications. Usually when that happens, I either start a new CVS branch (bad practice) or manually copy all existing files to a new directory for archive.

A problem appears later on when I attempt to reuse the same project files as a starting point for a new project. I cannot rename an existing MSVC6 project! This seems like a simple task at first. The problem though is that simply renaming the project filename does not automatically cause the workspace project title inside MSVC6 to change. Furthermore, simply changing the filename doesn't necessarily mean the generated executable will be named differently.

A bit of hack reviews that the workspace project title (as shown in the top image) can be renamed by altering a .dsp file. It was discovered that the executable name (debug and release) and all associated libraries are all contained inside a project .dsp (just like a Makefile). Thus a few search and replace on a .dsp file quickly accomplished what we set out to achieve.

The current implementation does exactly that. A search and replace strategy to look for existing workspace project name and replaces it with new name. The output, after running the app, is two new files (.dsp and .dsw).

I would like to emphasize again that this strategy enables all include libraries to remain intact. This is very important especially if you work with lots of third party libraries (I work with directshow, opencv, ipl and and few of my own).

The difficulty in renaming an existing workspace project title is summarized in this post. The suggested solutions seem to be consistent with my own findings. (A quick search on Google will review millions more.)

How it works

STL based search and replace. CString is not portable. Avoid at all cost.

How I use it

Assume that I have a solid working project in CVS.

  1. To start off a separate project, copy (checkout) the whole project directory - (!) no CVS residual - to another location.
  2. Rename directory.
  3. Execute renameDsw.exe to generate new project name and executable name.

Concluding remarks

Depending on your line of work, this little utility could be quite handy especially if you require different compilation and linkage parameters for various builds. For example, say, you have multiple implementations of a LIB file targeted for different machine architectures. Based on an existing working application, you can generate separate projects and add them back to the current workspace as shown below. Each project now, under the same workspace, has different compilation and linkage parameters.

Image 2

The current implementation utilized a separate MFC app to perform the search and replace task. Other implementations of course are also possible. i.e.: Marcos and App wizard etc...

Finally, I would like to comment on the reasons why I did not consider generating App wizard template. In fact, many of the template code are ideal to go into an App wizard template.

The primary reason that I did not go that route is because I found myself with numerous template applications that are compiling and executing solid. Generating different App wizard template involves investing more time resource for each different working project. I prefer simply copying from CVS and generating a new name from there.

Anyhow, I hope this could benefit someone who is still working with MSVC6 like me.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Researcher
Australia Australia
Computer Vision Research
Postgrad @Monash, Australia

Comments and Discussions

 
GeneralBug reported ! Pin
Yacine9500014-Sep-04 3:32
Yacine9500014-Sep-04 3:32 
Generaladding menu items to (right click) context menues Pin
robinraul12-Mar-03 12:13
robinraul12-Mar-03 12:13 
GeneralTool to completely rename project Pin
Anonymous10-Nov-02 22:06
Anonymous10-Nov-02 22:06 
GeneralRe: Tool to completely rename project Pin
beetung11-Nov-02 1:20
beetung11-Nov-02 1:20 
GeneralRe: Tool to completely rename project Pin
John M. Drescher3-Apr-03 6:26
John M. Drescher3-Apr-03 6:26 
GeneralRe: Tool to completely rename project Pin
beetung3-Apr-03 16:55
beetung3-Apr-03 16:55 
GeneralRe: Tool to completely rename project Pin
John M. Drescher4-Apr-03 3:54
John M. Drescher4-Apr-03 3:54 
GeneralRe: Tool to completely rename project Pin
Stephane Rodriguez.11-Nov-02 2:43
Stephane Rodriguez.11-Nov-02 2:43 
GeneralRe: Tool to completely rename project Pin
Kyle A11-Nov-02 6:41
Kyle A11-Nov-02 6:41 
GeneralRe: Tool to completely rename project Pin
Stephane Rodriguez.11-Nov-02 6:59
Stephane Rodriguez.11-Nov-02 6:59 
GeneralMSVC 6/CVS Pin
vboctor10-Nov-02 16:22
vboctor10-Nov-02 16:22 
GeneralRe: MSVC 6/CVS Pin
Emil Åström11-Nov-02 23:18
Emil Åström11-Nov-02 23:18 
QuestionCString is not portable? Pin
George9-Nov-02 0:13
George9-Nov-02 0:13 
AnswerRe: CString is not portable? Pin
beetung9-Nov-02 0:40
beetung9-Nov-02 0:40 
GeneralWhy I will never use it Pin
Stephane Rodriguez.8-Nov-02 21:28
Stephane Rodriguez.8-Nov-02 21:28 
GeneralRe: Why I will never use it Pin
beetung8-Nov-02 21:54
beetung8-Nov-02 21:54 
GeneralRe: Why I will never use it Pin
Stephane Rodriguez.8-Nov-02 22:24
Stephane Rodriguez.8-Nov-02 22:24 
GeneralRe: Why I will never use it Pin
beetung8-Nov-02 23:53
beetung8-Nov-02 23:53 
GeneralRe: Why I will never use it Pin
Todd Smith9-Nov-02 4:37
Todd Smith9-Nov-02 4:37 
GeneralRe: Why I will never use it Pin
beetung9-Nov-02 20:08
beetung9-Nov-02 20:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.