简体   繁体   English

Delphi MSBuild.exe 错误 MSB4057 但可以使用 IDE 构建项目

[英]Delphi MSBuild.exe error MSB4057 but can use IDE build project

I use Delphi XE4 on Windows7 and use Microsoft.NET/Framework/V3.5/MSBuild.exe .我在 Windows7 上使用 Delphi XE4 并使用 Microsoft.NET/Framework/V3.5/MSBuild.exe 。

I have added the MSBuild path to the environment variable.我已将 MSBuild 路径添加到环境变量中。

But got this error :(但是得到了这个错误:(

$MSBuild.exe Project3.dproj /target:Build /property:configutation=Debug
Microsoft (R) Build Engine Version 3.5.30729.5420
[Microsoft .NET Framework, Version 2.0.50727.8762]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 2017/10/30 ▒W▒▒ 10:45:40.
Project "C:\DXE4_LangDLL\Project3.dproj" on node 0 (Build target(s)).
C:\DXE4_LangDLL\Project3.dproj : error MSB4057: The target "Build" does not exist in the project.
Done Building Project "C:\DXE4_LangDLL\Project3.dproj" (Build target(s)) -- FAILED.

Build FAILED.

"C:\DXE4_LangDLL\Project3.dproj" (Build target) (1) ->
  C:\DXE4_LangDLL\Project3.dproj : error MSB4057: The target "Build" does not exist in the project.

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.00

I tried use Microsoft.NET/Framework/V2.0.50727/MSBuild.exe and got the same message.我尝试使用 Microsoft.NET/Framework/V2.0.50727/MSBuild.exe 并得到相同的消息。

I was confuse because used Delphi IDE to build project successfully.我很困惑,因为使用 Delphi IDE 成功构建了项目。

Can someone help me?有人可以帮助我吗?

You have to set first the environmental variables.您必须首先设置环境变量。 There is a batch file, at the path有一个批处理文件,在路径

C:\\Program Files (x86)\\Embarcadero\\Studio\\XX\\rsvars.bat C:\\Program Files (x86)\\Embarcadero\\Studio\\XX\\rsvars.bat

that i use for command-line batch files, where XX the version of your RAD Studio.我用于命令行批处理文件,其中 XX 是 RAD Studio 的版本。

I am not sure if it will work for Git bash as it is, but you can create a batch file that will combine the lines of rsvars.bat and the MSBuild line, and execute it我不确定它是否适用于 Git bash,但您可以创建一个批处理文件,将rsvars.bat行和MSBuild行组合起来,然后执行它

Something like:类似的东西:

@SET BDS=C:\Program Files (x86)\Embarcadero\Studio\XX
@SET BDSINCLUDE=C:\Program Files (x86)\Embarcadero\Studio\XX\include
@SET BDSCOMMONDIR=C:\Users\Public\Documents\Embarcadero\Studio\XX
@SET FrameworkDir=C:\Windows\Microsoft.NET\Framework\v3.5
@SET FrameworkVersion=v3.5
@SET FrameworkSDKDir=
@SET PATH=%FrameworkDir%;%FrameworkSDKDir%;C:\Program Files (x86)\Embarcadero\Studio\XX\bin;C:\Program Files (x86)\Embarcadero\Studio\XX\bin64;C:\Users\Public\Documents\Embarcadero\InterBase\redist\InterBaseXE3\IDE_spoof;%PATH%
@SET LANGDIR=EN
@SET PLATFORM=
@SET PlatformSDK=

$MSBuild.exe Project3.dproj /target:Build /property:configutation=Debug

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM