MSBuild does not work anymore with Tokyo

2019-07-09 04:56发布

问题:

I have multiple project groups that I want to compile at batch. There are over 100 projects in there.

In 2010 we had a "make" file like this:

call "c:\Borland\RAD Studio\19.0\bin\rsvars.bat"
"c:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" /t:Clean,Build  Group1.groupproj 

Under Tokyo it does not work anymore. I get:

C:\Borland\RAD Studio\19.0\Bin\CodeGear.Cpp.Targets(3695,5): error : Error: Unable to open file 'L_ER_FD.RES' [P:\Ent\_common\er\prj\l_er_fd.cbproj]

However, the project group compiles just fine from IDE.
We think it is related to the creation of the .vres file (from .rc) which are create in memory by the IDE and never written to file.

Notes:
- I tried this from C++ Builder Tokyo but I guess it happens also under Delphi. I will test that soon.
- I have MSBuild v12.

回答1:

I had the same problem and I managed to get around it. So I had the following script on older version of Rad Studio and it was working:

call rsvars.bat
call msbuild Utils25.cbproj /t:Clean;Build /p:Configuration=Release /p:platform=Win32 > result.err

but on Rad Studio 10.2.3 this was producing me a linking error like yours. After a lot of testing I found that if you do clean and build on separate msbuild calls it works as expected. So the following works:

call rsvars.bat
call msbuild Utils25.cbproj /t:Clean /p:Configuration=Release /p:platform=Win32 > clean.err
call msbuild Utils25.cbproj /t:Build /p:Configuration=Release /p:platform=Win32 > build.err