Click here to Skip to main content
Click here to Skip to main content

Renaming a workspace - .dsp and .dsw

, 28 Mar 2003
Rate this:
Please Sign up or sign in to vote.
A hack to rename a workspace (MSVC6 only).

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.

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

About the Author

beetung
Researcher
Australia Australia
Computer Vision Research
Postgrad @Monash, Australia

Comments and Discussions

 
GeneralBug reported ! PinmemberYacine9500014-Sep-04 3:32 
Generaladding menu items to (right click) context menues Pinmemberrobinraul12-Mar-03 12:13 
GeneralTool to completely rename project PinsussAnonymous10-Nov-02 22:06 
GeneralRe: Tool to completely rename project Pinmemberbeetung11-Nov-02 1:20 
GeneralRe: Tool to completely rename project PinmemberJohn M. Drescher3-Apr-03 6:26 
GeneralRe: Tool to completely rename project Pinmemberbeetung3-Apr-03 16:55 
GeneralRe: Tool to completely rename project PinmemberJohn M. Drescher4-Apr-03 3:54 
GeneralRe: Tool to completely rename project Pinmember.S.Rod.11-Nov-02 2:43 
GeneralRe: Tool to completely rename project PinmemberKyle Alons11-Nov-02 6:41 
GeneralRe: Tool to completely rename project Pinmember.S.Rod.11-Nov-02 6:59 
GeneralMSVC 6/CVS Pinmembervboctor10-Nov-02 16:22 
GeneralRe: MSVC 6/CVS PinmemberEmil Åström11-Nov-02 23:18 
QuestionCString is not portable? PinmemberGeorge9-Nov-02 0:13 
AnswerRe: CString is not portable? Pinmemberbeetung9-Nov-02 0:40 
GeneralWhy I will never use it Pinmember.S.Rod.8-Nov-02 21:28 
GeneralRe: Why I will never use it Pinmemberbeetung8-Nov-02 21:54 
GeneralRe: Why I will never use it Pinmember.S.Rod.8-Nov-02 22:24 
GeneralRe: Why I will never use it Pinmemberbeetung8-Nov-02 23:53 
GeneralRe: Why I will never use it PinmemberTodd Smith9-Nov-02 4:37 
GeneralRe: Why I will never use it Pinmemberbeetung9-Nov-02 20:08 

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

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

| Advertise | Privacy | Mobile
Web04 | 2.8.140709.1 | Last Updated 29 Mar 2003
Article Copyright 2002 by beetung
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid