views:

974

answers:

4

We're implementing Team Build and know we need to write MSBuild scripts to build our legacy VB 6 app. It's configured to use Binary Compatibility and we break Compatibility occassionally and we'd like our new automated build process to be able to Break Compatibility automatically.

Anyone know how to do this or if it's even possible?

Alternatively, I know that the break just changes the compatibility to No Compatibility, compiles, changes to Binary and recompiles. If anyone knows how to just change Compatibility from the command line this would also be helpful.

+1  A: 

Regarding changing from Compatibility to No Compatibility, I've done things like this by editing the project file with Unix-style tools (sed, awk, and/or perl). Do not change the original project file, but instead generate a new/temporary project file, and build with that. Here's an example:

sed -e "s/CompatibleMode=0/CompatibleMode=2" <myProj.vbp >tmpProj.vbp

You can use this technique for other purposes, such as inserting a version number into the project file.

jdigital
+1  A: 

The /d switch allows you to replace project property values at compile time. Try

VB6 /MAKE c:\Some.vbp /outdir c:\somedir\ /d CompatibleMode="0"
cmsjr
Hmm... Are you sure this trick works with VB 6.0 (and with DLLs)? Help doc says /d is for defining compilation constants. I still tried to use it and it did not work at all! :-(
Yarik
A: 

This works:

VB6 /MAKE c:\Some.vbp /outdir c:\somedir\ /d CompatibleMode="0" CompatibleEXE32=""

A: 

I am not sure any of the solutions above work. we had same issues in our product. we had to write a vb project that (also functioned as an addin) to break compatibility and build the project. the vb project, reads the existing VB file, generates a new vbp file with project compatibility settings and new destination for the generated dll. the destination would be the same folder where the ref-dll resides. once the dll is built, the old dll's is removed and new red-dll one is renamed to match the old one. at the end of it, all temp files will be removed. the vb project has an exposed function that takes one parameter which is the vbp file. this could be run from a vb script. so essentially the command line argument would be BuildRefDll.vbs vb6.exe /make

Jealani