Jump to content
dmitrybv

Is it possible that the <RAD Studio>\bin\rsvars.bat file does not set all the necessary variables for MSBuild to work correctly?

Recommended Posts

I have a Compile.Cmd file that I run from my VCL application to compile my packages.

File Compile.Cmd


 

Call C:\RADStudio\22.0\Bin\rsvars.bat
ECHO BDS=%BDS%
ECHO BDSCOMMONDIR=%BDSCOMMONDIR%
%FrameworkDir%\MSBuild EhLib.Rtl.dproj /t:Build /p:Config=Release /p:platform=Win32

I run this file using the CreateProcess function with the parameter CmdLine = cmd.exe /c Compile.Cmd

 

1.--
If I run my program from under RAD Studio 12 (Rtl Ver 23), then when I execute cmd.exe /c Compile.Cmd, an error is displayed:

 

cmd.exe /c C:\RADStudio\23.0\Projects\EhLib12_Installer\Installer\Compile.Cmd

C:\Users\Public\Documents\Embarcadero\Studio\22.0\Components\EhLib\Src>Call C:\RADStudio\22.0\Bin\rsvars.bat

BDS=C:\RADStudio\22.0

BDSCOMMONDIR=C:\Users\Public\Documents\Embarcadero\Studio\22.0



Copyright (C) Microsoft Corporation. All rights reserved.
Done Building Project "C:\Users\Public\Documents\Embarcadero\Studio\22.0\Components\EhLib\Src\EhLib.Rtl.dproj" (Build target(s)) -- FAILED.
Build FAILED.
EhLib.Rtl.dpk(38): error E2213: Bad packaged unit format: c:\radstudio\23.0\lib\Win32\release\rtl.dcp.System - Expected version: 35.0, Windows Unicode(x86) Found version: 36.0, Windows Unicode(x86) [C:\Users\Public\Documents\Embarcadero\Studio\22.0\Components\EhLib\Src\EhLib.Rtl.dproj]
1 Error(s)
Time Elapsed 00:00:00.23


It is clear that MSBuild starts using library files of version 35.0 and 36.0 simultaneously.

 

2.--
If I run my compiled exe file directly from File Explorer, the cmd.exe /c Compile.Cmd command works without errors. And MSBuild compilation occurs without errors.

 

3.--
Is it possible that rsvars.bat does not set all the necessary environment variables for MSBuild to work correctly and MSBuild picks up these variables from the higher-level process bds.exe and thus an intersection of versions of the base libraries is formed?


For example, rsvars.bat does not set the environment variables BDSLIB and BDSBIN.

 

Share this post


Link to post

You seem to be mixing:

  • C:\RADStudio\22.0 
    Call C:\RADStudio\22.0\Bin\rsvars.bat
  • C:\RADStudio\23.0 
    cmd.exe /c C:\RADStudio\23.0\Projects\EhLib12_Installer\Installer\Compile.Cmd

 

Share this post


Link to post
On 9/26/2024 at 2:14 PM, dmitrybv said:

Is it possible that rsvars.bat does not set all the necessary environment variables for MSBuild to work correctly

When I was adding Delphi 12.2 in our build server I remember below value was missing in rsvars.bat

BDSLIB=C:\Delphi12.2\lib

You need to point it to your correct directory.

  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×