VC++7 to VC++6 project converter
3 a( E3 i8 ?% i# q' _By Stephane Rodriguez. 1 ?7 H9 f& t4 e
0 ^# x+ g b. z# P1 T% j5 YThis tool automatically converts Visual C++ 7.0 projects back to Visual C++ 6.0 projects.
8 f! `" T L) q: d4 d3 bWhat is this ?3 W, t. h5 ~* c9 b* j: l( }, t
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.* c9 B/ H7 S& ~( \
( J8 J" J7 ~1 p% \( p4 J- vImportant note, there is no loss during the conversion: source code is left unchanged; only .dsw/.dsp are created (or overwritten).
, i# N& Z5 A2 r3 o3 _5 h% Z- q: P: z+ s' e9 l5 l
Why?
+ p' r7 I9 h3 P- Y8 O4 O! x' GFirst 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.# ^" _0 ]8 s7 l! T: x, ~5 x
% B% {/ Y- [. RWithout 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:
& R' ~) ?! m- ~
" h1 A' V6 ~( l" D. K1 T% QSomeone gives you a VC++ 7 project, and you only have VC++ 6 installed.
/ v: Q0 A3 _! u! U" gYou 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. # { u1 Y9 ^ G$ \) B) B8 k/ ]
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. ' o" _9 s2 Q2 {2 f- w
How to use it# u* p1 F7 m3 V ?- @% O
The tool is a command line of the form:
( W% E, M! C* k) s* i# }% ~: e# Q% W+ u! S+ l* `& H- T
prjconverter <solutionname (full filepath)>[.sln]
* N: g5 G+ {; B/ |+ {' lFor instance,: X T/ K: f! c' P$ v' `
+ T7 [+ g6 z+ g- u3 X: Z6 v
prjconverter c:\tmp\betterxml\betterxml.sln1 o* X5 ^* Y/ p! G8 k
For info, type prjconverter.exe alone in the console.4 F% {$ y7 a5 u0 I
( B" m% i( m6 I2 b2 WWhat is converted5 H/ x3 e. K" b: R. h/ z! e
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.
3 j- a( T: o- t0 B: d
# S2 a, X5 p3 d: |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.4 W9 [9 E3 g# G5 D' F* ]& t$ b
" c8 O) ^/ m$ D( G }. ?! Q7 f
Of course we care about project configurations (debug, release, ...), and custom file configuration settings.3 Q4 Y+ V" o( [( w0 i
0 H$ u% i [/ i9 l! T5 [2 Z6 n* h0 ETechnical details2 Z+ a- I8 F1 b& T$ T) ~
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).
# h% w+ E* [% c
! ~* w8 M( ~1 j+ s& k+ {1 p1 `Disclaimer4 n; J7 @' r) u, E/ `. Y
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. S$ m5 j9 V- a A- }
' s9 `& g+ ^0 _1 u/ c8 ]! z3 v+ f
Update history
3 G F/ p N9 ]6 ^1 E6 c6 A, a% _8 \% D% c+ V
終於找到了。哈哈 |