Click here to Skip to main content
15,887,214 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: $(ConfigurationName) Pin
Ed Cieslik1-Oct-08 23:30
Ed Cieslik1-Oct-08 23:30 
GeneralRe: $(ConfigurationName) Pin
Ed Cieslik1-Oct-08 23:33
Ed Cieslik1-Oct-08 23:33 
GeneralProblems with MFC ActiveX control Projects Pin
emadns23-Mar-05 20:02
emadns23-Mar-05 20:02 
GeneralGreat Work!! Pin
Ganesh_NV14-Mar-05 20:10
Ganesh_NV14-Mar-05 20:10 
Generalmsxml2.h Pin
gdom10-Mar-05 6:57
gdom10-Mar-05 6:57 
GeneralDSP file format Pin
atech21-Jan-05 9:48
atech21-Jan-05 9:48 
GeneralRe: DSP file format Pin
Stephane Rodriguez.24-Jan-05 9:44
Stephane Rodriguez.24-Jan-05 9:44 
QuestionWhat am I doing wrong? Pin
cdhuntsman22-Dec-04 11:31
cdhuntsman22-Dec-04 11:31 

I am running Windows XP and have Visual Studio 6.0. My interest is to work with some of the MSDN Samples, the body of which can be downloaded directly from the MSDN site. Having said that, the particular case in point is the BUTTON sample (although this problem appears on all of the other samples I tried). I copied the BUTTON sample files to a folder of the same name. One can see that the samples have been converted to VC7 as indicated by the button.vcproj and button.sln files. Using a console window I entered "prjconverter BUTTON" and the files, BUTTON.dsw and button.dsp appear as expected in the BUTTON folder. From an explorer window I double-click the BUTTON.dsw file to start VC6. This happens and the program launches with all files and resources in place in the project. At this point I select "Rebuild All" from the "Build" menu item. The following build output window text appears:

<font=+1>
--------------------Configuration: button - Win32 Release--------------------
Linking...
Microsoft (R) Incremental Linker Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /subsystem:windows /dll /incremental:no "/pdb:Release/.pdb" /machine:IX86 "/def:.\button.def" "/out:Release\
.ocx" "/implib:.\Release/button.lib" /pdbtype:sept
".\Release\btnctl.obj"
".\Release\btnppg.obj"
".\Release\button.obj"
".\Release\stdafx.obj"
".\Release\button.res"
Creating library .\Release/button.lib and object .\Release/button.exp
button.exp : warning LNK4070: /OUT:BUTTON.OCX directive in .EXP differs from output filename "Release\.ocx"; ignoring directive
Registering OLE control...


At this point a message box appears with the following information:

<font=+1>
LoadLibrary("\s")failed - The specified module could not be found.


After clicking the OK button, the build output continues with:

<font=+1>
$(ProjectName).ocx - 0 error(s), 1 warning(s)
The following environment variables were not found
$(ProjectName)


I have built several VC++ 6.0 applications, dlls, and console apps, and no build has given me this problem. So, I am assuming at this point that there is yet another conversion to perform using another utility of which I am not aware, or I have forgotten to do some fundamental operations before attempting the build.

In any case, is there anyone out there who can help me?

Thanks in advance to anyone who has waded through this epistle.

AnswerRe: What am I doing wrong? Pin
Stephane Rodriguez.31-Dec-04 11:35
Stephane Rodriguez.31-Dec-04 11:35 
GeneralHelp project problems Pin
Adrian ~ Foobar Software19-Dec-04 8:18
Adrian ~ Foobar Software19-Dec-04 8:18 
Generalsolution dependencies removed Pin
davelasker12-Dec-04 8:28
davelasker12-Dec-04 8:28 
GeneralRe: solution dependencies removed Pin
Stephane Rodriguez.14-Dec-04 9:58
Stephane Rodriguez.14-Dec-04 9:58 
GeneralRe: solution dependencies removed Pin
Adrian ~ Foobar Software19-Dec-04 8:11
Adrian ~ Foobar Software19-Dec-04 8:11 
Generalconversion Pin
andi999-Dec-04 5:20
andi999-Dec-04 5:20 
GeneralRe: conversion Pin
Stephane Rodriguez.14-Dec-04 9:45
Stephane Rodriguez.14-Dec-04 9:45 
GeneralThank you Pin
Yulianto.28-Sep-04 19:35
Yulianto.28-Sep-04 19:35 
GeneralThank You! Pin
G A McHale14-Sep-04 20:19
G A McHale14-Sep-04 20:19 
Generalthank you Pin
Anonymous12-Sep-04 0:35
Anonymous12-Sep-04 0:35 
Generalnew edition down Pin
yjh19829-Sep-04 15:57
yjh19829-Sep-04 15:57 
GeneralRe: new edition down Pin
Stephane Rodriguez.10-Sep-04 1:30
Stephane Rodriguez.10-Sep-04 1:30 
GeneralRe: new edition down Pin
yjh198212-Sep-04 14:56
yjh198212-Sep-04 14:56 
GeneralRe: new edition down Pin
G A McHale14-Sep-04 20:22
G A McHale14-Sep-04 20:22 
GeneralRe: new edition down Pin
pblais30-Apr-07 10:24
pblais30-Apr-07 10:24 
GeneralSymbol Issue Pin
BRG8-Sep-04 0:52
BRG8-Sep-04 0:52 
GeneralRe: Symbol Issue Pin
s r8-Sep-04 9:48
s r8-Sep-04 9:48 

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.