PDA

View Full Version : Problems building mixed Delphi 2007 / 2009 project


tgr
05-16-2009, 04:53 AM
I have a project including both Delphi 2007 and Delphi 2009 steps.

The Delphi 2009 step builds fine.

The problem is the Delphi 2007 step -- MsBuild reports 2 errors. After some experimenting, I found that the command line created by Visual Build Pro refers to the wrong folder for rsvars.bat:

cmd /c "@echo off&"C:\Program Files (x86)\CodeGear\RAD Studio\6.0\Bin\rsvars.bat"&C:\Windows\Microsoft.NET\Framework\v2.0.50727\MSBu ild.exe C:\Temp\Project1.dproj /p:Configuration=Release||exit -1"

The correct statement should be:
cmd /c "@echo off&"C:\Program Files (x86)\CodeGear\RAD Studio\5.0\Bin\rsvars.bat"&C:\Windows\Microsoft.NET\Framework\v2.0.50727\MSBu ild.exe C:\Temp\Project1.dproj /p:Configuration=Release||exit -1"

Is there a way to force Visual Build Pro to use the correct rsvars.bat?

Thanks, Trond

kinook
05-18-2009, 07:52 AM
The Make Delphi action determines that path by finding the highest version key in the registry under

HKEY_LOCAL_MACHINE\SOFTWARE\CodeGear\BDS

(for D2009, it's 6.0) and reading the RootDir value from that key. You could temporarily update this registry value to point to D2007 before building D2007 projects, then change it back to the D2009 path afterwards.
http://www.kinook.com/VisBuildPro/Manual/writeregistry.htm

tgr
05-18-2009, 12:29 PM
Thank you for the suggestion.

I checked a couple of PCs, and found the keys for Delphi 2007 and 2009 under:

HKEY_CURRENT_USER\Software\Borland\BDS\5.0

and

HKEY_CURRENT_USER\Software\CodeGear\BDS\6.0

(I guess it depends on the choices made during installation whether these keys are located under HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER.)

So changing
HKEY_CURRENT_USER\Software\CodeGear\BDS\6.0\RootDi r
to temporarily point to the Delphi 2007 folder should do the trick?


Anyway, I tried another (possibly less elegant) solution while experimenting with this:

1) Setting the "Don't build the project(s), but update any other properties that are chosen" to ON

2) Adding a Run Program step with the modified cmd statement

This works partly ok. -- The version info doesn't get updated when I uncheck the "Don't build the project(s), but update any other properties that are chosen".

Regards,
Trond

kinook
05-18-2009, 12:44 PM
The Make Delphi action looks only under HKEY_LOCAL_MACHINE, not HKEY_CURRENT_USER.

Another option would be to check 'Do not run rsvars.bat before MSBuild' on the Options tab and specify the appropriate rsvars.bat command in the 'Command to run before main command' field on the Advanced tab.

http://www.kinook.com/VisBuildPro/Manual/delphioptionstab.htm
http://www.kinook.com/VisBuildPro/Manual/programadvancedtab.htm

tgr
05-18-2009, 01:20 PM
Thanks for the suggestion.

I tried the follwing settings:

Override the default location of the command-line compiler executable:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\MSBu ild.exe

Do not run rsvars.bat befor MSBuild:
Checked

Command to run before main command:
C:\Program Files (x86)\CodeGear\RAD Studio\5.0\Bin\rsvars.bat

...but the resulting command line fails:
cmd /c C:\Program Files (x86)\CodeGear\RAD Studio\5.0\Bin\rsvars.bat&"C:\Program Files (x86)\CodeGear\RAD Studio\6.0\Bin\brcc32.exe" Test2007.vrc -foC:\Temp\VisualBuildPro\Test2007.vres

... and actually looks quite different from what I expected:
cmd /c "@echo off&"C:\Program Files (x86)\CodeGear\RAD Studio\5.0\Bin\rsvars.bat"&C:\Windows\Microsoft.NET\Framework\v2.0.50727\MSBu ild.exe C:\Temp\Project1.dproj /p:Configuration=Release||exit -1"

Regards, Trond

tgr
05-18-2009, 01:40 PM
Further to the location of the registry keys:

I just checked and older PC running Windows XP with Delphi 2007 installed, and found the keys under HKEY_LOCAL_MACHINE as you describe it.

On my two Vista 64 PCs there is no HKEY_CURRENT_USER\Software\CodeGear section.

Regards,
Trond

kinook
05-18-2009, 04:06 PM
If version/property changes are specified, the Make Delphi action first updates the project .res file (using brcc32.exe) before building.
http://www.kinook.com/VisBuildPro/Manual/delphiaction.htm

Try putting double quotes around the .bat filename:

"C:\Program Files (x86)\CodeGear\RAD Studio\5.0\Bin\rsvars.bat"

If that doesn't help, please provide the error information. Thanks.

tgr
05-19-2009, 10:46 AM
Adding the quotes still fails. See error messages below:


19.05.2009 17:41:21: --------------------Starting Build: 'Testproject-1.bld'--------------------
19.05.2009 17:41:21: Building project step 1 - Build Application...
19.05.2009 17:41:21: Building project step 3 - Make Delphi 2007 project...
incrementing version...compiling VERSIONINFO RC file...
cmd /c "C:\Program Files (x86)\CodeGear\RAD Studio\5.0\Bin\rsvars.bat" &"C:\Program Files (x86)\CodeGear\RAD Studio\6.0\Bin\brcc32.exe" Test2007.vrc -foC:\Temp\VisualBuildPro\Test2007.vres
C:\Program is not recognized as an internal or external command,
operable program or batch file.

Process completed with exit code 1
19.05.2009 17:41:21: Step '3 - Make Delphi 2007 project' failed
19.05.2009 17:41:21: Build successfully completed.


Regards,
Trond

kinook
05-19-2009, 12:32 PM
Looks like two double quotes are needed at the beginning.

""C:\Program Files (x86)\CodeGear\RAD Studio\5.0\Bin\rsvars.bat"

tgr
05-19-2009, 01:01 PM
No, that still doesn't do it:

19.05.2009 19:37:57: --------------------Starting Build: 'Testproject-1.bld'--------------------
19.05.2009 19:37:57: Building project step 3 - Make Delphi 2007 project...
incrementing version...compiling VERSIONINFO RC file...
cmd /c ""C:\Program Files (x86)\CodeGear\RAD Studio\5.0\Bin\rsvars.bat"&"C:\Program Files (x86)\CodeGear\RAD Studio\6.0\Bin\brcc32.exe" Test2007.vrc -foC:\Temp\VisualBuildPro\Test2007.vres
Setting environment for using CodeGear RAD Studio tools
Filnavnet, mappenavnet eller volumnavnesyntaksen er feil.

Process completed with exit code 1
19.05.2009 19:37:58: Step '3 - Make Delphi 2007 project' failed
19.05.2009 19:37:58: Build successfully completed.

kinook
05-19-2009, 04:15 PM
Strange, it works ok here. You may need to use the other workaround for now (create/update registry value). We'll also consider adding an option to specify the rsvars.bat location, which overrides the default.

tgr
05-19-2009, 04:38 PM
Ok. The other solution works just great so I'm fine for now. Adding a custom override for the rsvars.bat location, sounds like a good idea.

Thanks a lot,
Trond

kinook
10-14-2009, 06:11 PM
This is available in v7.