Automate Delphi 2010 project build with MSBuild

白昼怎懂夜的黑 提交于 2019-12-04 10:31:17

问题


I'm looking to compile my Delphi 2010 project using MSBuild, but something isn't right, I just couldn't make MSBuild to compile my project.

I tried this command line:

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" "C:\MyProject\Myapp.dproj" /t:Release

and this:

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" "C:\MyProject\Myapp.dproj" /p:Configuration=Release /t:Release

But MSBuild won't recognize my build configuration!

I also changed [ rsvars.bat ] but it didn't work!

@SET BDS=C:\Program Files (x86)\Embarcadero\RAD Studio\7.0
@SET BDSCOMMONDIR=C:\Users\Public\Documents\RAD Studio\7.0
@SET FrameworkDir=C:\Windows\Microsoft.NET\Framework\v4.0.30319
@SET FrameworkVersion=v4.0.30319
@SET FrameworkSDKDir=
@SET PATH=%FrameworkDir%;%FrameworkSDKDir%;%PATH%
@SET LANGDIR=EN

The MSBuild error is:

C:\MyProject\Myapp.dproj : error MSB4057: The target "Release" does
not exist in the project.

Any help to get me build my app with MSBuild would be greatly appreciated.

(Yes, I'm fully aware of tools like FinalBuilder, I just want to learn how to do this with MSBuild)

Thanks!


回答1:


You need to switch the parameters. The target parameter (/t) tells MSBuild which target to create. This can be either 'Make', 'Clean' or 'Build' (or a combination of those - seperate them with ';' in this case).

The property parameter (/p) forwards properties to the actual compiler. You can specify for example the configuration using /p:config=

So if you want to clean and then build a project using the release configuration, specify the paramters like this:

msbuild.exe "/t:Clean;Build" "/p:config=Release" Myapp.dproj



回答2:


Change /p:Configuration=Release to /p:config=Release



来源:https://stackoverflow.com/questions/9334001/automate-delphi-2010-project-build-with-msbuild

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!