Click here to Skip to main content
15,892,674 members
Articles / Programming Languages / C++

VC++7 to VC++6 Project Converter

Rate me:
Please Sign up or sign in to vote.
4.92/5 (204 votes)
22 Oct 20033 min read 1.1M   25.6K   247   261
Automatically convert Visual C++ 7.0 projects back to Visual C++ 6.0 projects.
This tool automatically converts VC++7 projects back to VC++6 projects. Without this tool, you end up recreating your projects from scratch, which is a total waste of time, and prone to errors. In this post, you will find a list of scenarios where this tool is useful. You will also find out how to use it, what is converted and technical details.

Image 1

What Is This ?

This tool automatically converts Visual C++ 7.0 projects back to Visual C++ 6.0 projects. In other words, .sln/.vcproj file pairs are translated to .dsw/.dsp file pairs.

Important note, there is no loss during the conversion: source code is left unchanged; only .dsw/.dsp are created (or overwritten).

Why?

First of all, because MS doesn't provide it. It's easy to become cynical against MS when you feel how bad it is to sell developer tools without all the necessary "moulinettes" (converters in ugly English) to go backward.

Without this tool, you end up recreating your projects from scratch: a total waste of time, and prone to errors. Actually, there are several scenarios where this tool is useful:

  • Someone gives you a VC++ 7 project, and you only have VC++ 6 installed.
  • You have upgraded your project(s) from VC++ 6 to VC++ 7, and you have both .dsw/.dsp and .sln/.vcproj files on your local system drive, but you are willing to keep those files synchronized so any time you need to open the project, you need not bother the VC++ version you work with.
  • Provide both versions of projects (for instance, when you share code on CodeProject), so your audience does not need to bother with knowing which devtool is required.

How to Use It

The tool is a command line of the form:

prjconverter <solutionname (full filepath)>[.sln]

For instance:

prjconverter c:\tmp\betterxml\betterxml.sln

For info, type prjconverter.exe alone in the console.

What is Converted

A few steps to let you know how the work gets done. The .sln solution file is opened and translated to the .dsw file format, along with all project declarations, dependencies, and source control tags.

Then all .vcproj project files are translated to .dsp files. I use MSXML to parse the .vcproj file format, and build the meta-model out of it. Then what's left to do is serialize all those XML thingies into the standard .dsp symbol lines.

Of course, we care about project configurations (debug, release, ...), and custom file configuration settings.

Technical Details

In the code provided, slnprocess.cpp does the .sln =>.dsw conversion. vcprojprocess.cpp does the .vcproj => .dsp conversion. And vcprojconfiguration.cpp holds the project meta-model (all project setting tabs). In VC++ 7, the meta-model is now programmable. Let's check out this link. In fact, vcprojconfiguration.cpp reflects exactly this meta-model (as if it was internal MS code).

Disclaimer

This tool has been extensively tested before being published (MFC/COM/ATL/console apps, makefiles, ...). Though I am willing to know if there is anything I can do in order to improve it, let me clearly say that it's not my fault if your project is corrupted by this tool.

Update History

  • 27th September, 2002 - Code complete
  • 2nd October, 2002 - Now it is possible to convert .vcproj files alone (no need of a root .sln file): just type the .vcproj full path in the command line.
  • 30th October, 2002 - Improvements based on user feedback: added missing default link libraries, expanded certain macro variables such like $(OutDir) and $(IntDir), replaced or removed certain macro variables not supported by VC6 such like $(NoInherit), added /GX (exception handling enabled)
  • 13th November, 2002 - Bug fixes: filenames with spaces, MFC extension DLL support, custom precompiled header setting, project setting inheritance

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
France France
Addicted to reverse engineering. At work, I am developing business intelligence software in a team of smart people (independent software vendor).

Need a fast Excel generation component? Try xlsgen.

Comments and Discussions

 
GeneralRe: C#.NET 1.1 to 1.0 Pin
Derek Lakin25-Jun-03 3:52
Derek Lakin25-Jun-03 3:52 
GeneralRe: C#.NET 1.1 to 1.0 Pin
Kant25-Jun-03 3:58
Kant25-Jun-03 3:58 
GeneralRe: C#.NET 1.1 to 1.0 Pin
Stephane Rodriguez.25-Jun-03 4:41
Stephane Rodriguez.25-Jun-03 4:41 
GeneralConsole app Pin
bartlomiej19-Jun-03 1:03
bartlomiej19-Jun-03 1:03 
GeneralRe: Console app Pin
Stephane Rodriguez.19-Jun-03 1:12
Stephane Rodriguez.19-Jun-03 1:12 
GeneralConsole app Pin
bartlomiej19-Jun-03 1:03
bartlomiej19-Jun-03 1:03 
GeneralI'm trying to convert this project -> Pin
karlzzzz4-May-03 7:27
karlzzzz4-May-03 7:27 
GeneralRe: I'm trying to convert this project -> Pin
Stephane Rodriguez.4-May-03 8:22
Stephane Rodriguez.4-May-03 8:22 
eMule does really use MFC7 classes. While the converter does a good job in providing a .dsp file to compile the product, it doesn't convert code using MFC7 to MFC6. In fact, the converter doesn't convert the source code at all.

Once I got the .dsp file and tried to compile it, I had to do manual changes over the source code to compile it. Although I list a few of them below, I have to confess I have the aborted the process since I have no interest in being able to compile eMule. I would even suggest you to send an email to eMule guys and ask for an explicit VC++6 compatible version, if they have it.
Here are a couple of things I did :
- remove the duplicated Loggable.cpp entry from the project tree, since a file can appear only once.
- in stdafx.h, replace <afxdhtml.h> with <afxhtml.h>
- in knownfile.h, replace GetCount() with GetSize(). ( the MFC6 CArray class dos not implement GetCount() ).
- replace all occurences of DWORD_PTR with DWORD, and all occurences of INT_PTR with INT : to get things simple, just create two macros in stdafx.h : #define DWORD_PTR DWORD, and #define INT_PTR INT
- in storedsources.h, replace GetCount() with GetSize()
- in mulelistctrl.h, replace CList<DWORD_PTRgt; with CList<DWORD_PTR,DWORD_PTR>
- in StatisticsDlg.h, replace :
const static int AVG_SESSION = 0;
const static int AVG_TIME = 1;

with
const static int AVG_SESSION;
const static int AVG_TIME;

- in StatisticsDlg.cpp, add :
const 	static int CStatisticsDlg::AVG_SESSION =0;
const 	static int CStatisticsDlg::AVG_TIME =1;

- in mdump.h, change M:\\dev7\\vs\\devtools\\common\\win32sdk\\include\\dbghelp.h by the correct path (it depends on your VC++ installation)/
- in ArchiveRecovery.cpp, replace GetBuffer() with GetBuffer(0)
- and then I am stuck (I won't spend time on it though) on DialogMinTrayBtn.hpp where the eMule guys use an extended template construction which I believe is not compatible with the VC++6 compiler. May be that's just me ! Good luck!
GeneralRe: I'm trying to convert this project -> Pin
karlzzzz6-May-03 8:31
karlzzzz6-May-03 8:31 
Generalhelp me please Pin
bindmania27-Apr-03 20:50
bindmania27-Apr-03 20:50 
GeneralRe: help me please Pin
Stephane Rodriguez.27-Apr-03 21:37
Stephane Rodriguez.27-Apr-03 21:37 
Questionwhat's wrong? Pin
johnosomeonetook,4-Apr-03 6:52
johnosomeonetook,4-Apr-03 6:52 
AnswerRe: what's wrong? Pin
Stephane Rodriguez.4-Apr-03 7:05
Stephane Rodriguez.4-Apr-03 7:05 
Questionwhy? Pin
babiq2-Apr-03 15:47
babiq2-Apr-03 15:47 
AnswerRe: why? Pin
Stephane Rodriguez.2-Apr-03 18:53
Stephane Rodriguez.2-Apr-03 18:53 
GeneralGood but... Pin
alan932-Apr-03 3:48
alan932-Apr-03 3:48 
GeneralRe: Good but... Pin
Stephane Rodriguez.2-Apr-03 18:58
Stephane Rodriguez.2-Apr-03 18:58 
QuestionNo Classwizard Support? Pin
mrfreezie13-Mar-03 17:35
mrfreezie13-Mar-03 17:35 
AnswerRe: No Classwizard Support? Pin
Stephane Rodriguez.13-Mar-03 18:50
Stephane Rodriguez.13-Mar-03 18:50 
GeneralSynchronizing Pin
MoMad29-Jan-03 13:11
MoMad29-Jan-03 13:11 
GeneralRe: Synchronizing Pin
Stephane Rodriguez.29-Jan-03 21:34
Stephane Rodriguez.29-Jan-03 21:34 
GeneralRe: Synchronizing Pin
MoMad30-Jan-03 5:14
MoMad30-Jan-03 5:14 
GeneralRe: Synchronizing Pin
s_rougeaux8-Jul-03 22:13
s_rougeaux8-Jul-03 22:13 
QuestionNow what about a dsw to sln converter? Pin
bryanjamesross20-Jan-03 14:19
bryanjamesross20-Jan-03 14:19 
AnswerRe: Now what about a dsw to sln converter? Pin
Chris Richardson20-Jan-03 16:16
Chris Richardson20-Jan-03 16:16 

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.