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!
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
Change /p:Configuration=Release to /p:config=Release
Related
I have a solution that has a Web Site (not a Web Application) and I'm having trouble setting up my Visual Studio Build task.
Usually I setup my MSBuild Arguments like so
/p:DeployOnBuild=true
Then in my Copy Publish Artifact, I e
$(build.sourcesDirectory)/AppSolution/Website/obj/$(BuildConfiguration)/Package/PackageTmp
What MSBuild Arguments do I need to set so that I can make the above work?
The files do not get copied over to the obj/$BuildConfiguration)/Package/PackageTmp folder. So when I go look at the output folder, it just looks like the code files. Not the binaries
Use the MSBuild argument /p:PackageLocation=$(Build.ArtifactStagingDirectory), then publish $(Build.ArtifactStagingDirectory) as an artifact.
I have an automated build set up in tfs2015 using a web build definition (i.e. not a xaml build definition) and I am looking to pass a custom property to the msbuild command.
I have tried setting a variable in the definition but this is not used in the build process.
the msbuild command argument that I need to pass is /p:myProperty="bob"
The build definition has variables:
yet when I build I get the msbuild command:
C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe "C:\Build\Agent\_work\5ad80936\FullSolution.sln" /nologo /m /nr:false /fl /flp:"logfile=C:\Build\Agent\_work\5ad80936\FullSolution.sln.log" /dl:CentralLogger,"C:\Build\Agent\agent\worker\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll"*ForwardingLogger,"C:\Build\Agent\agent\worker\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:platform="any cpu" /p:configuration="release"
So the BuildConfiguration and BuildPlatform variables are used in the way I would like myProperty to be used, yet this variable is ignored.
I have tried prefixing my variable name with 'Build', but this made no difference.
Can anyone help?
Incidentally, if run the msbuild command locally and append the required argument the build does exactly what I want.
I have found the answer, the variables are simply that, variables. To use those variables as msbuild command line arguments requires the setting of another part of the build definition:
On the build tab set the MSBuild Arguments parameter to use the variable that you have created:
The part in the $() is the variable name used in the TFS build definition, the portion before the = is the name of the property in your msbuild script. These do not necessarily need be the same
I'd like to make builds from the command line and I'm wondering if there's a way how to execute the command line compiler with selected build configuration ?
I know there is option --no-config which won't load default dcc32.cfg file but I would like to set the build configuration I've prepared in my project.
I would like to run something like
dcc32.exe --some-option RELEASE Win32 PLATFORM
Is there some option for selecting build configuration ?
Thank you
You need to be using msbuild rather than dcc32 for this:
msbuild myproject.dproj /p:Config=RELEASE;Platform=Win32
Make sure you have called the rsvars.bat file from the RAD Studio bin folder before you attempt to call msbuild. This sets up the necessary environment variables.
The great thing about the modern msbuild based build system, as implemented in Delphi, is that you can quite easily ensure that your command line builds are identical to your IDE builds.
As far as I know, you can use the dcc64.exe to compile for 64-bit if you do not want to use MSBuild. It is in the same folder as the dcc32.exe (and dccosx.exe for compile for OSX)
I use TFS 2010, VS 2010.
I wrote a custom msbuild proj file which I use locally to build my solution. I use MSBUILD.exe TFSBuild.proj and it does everything in my local machine. (I have a taregt called 'DoMyBuild' which kicks off the build and does everything.)
I have used this in the DefaultTargets attribute as below:
<Project DefaultTargets="DoMyBuild" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
I am trying hard to configure this to use my build server with a build definition. In the build definition, under Process - I configured 'Upgrade Template' and in the build process paramters, have given the path to this TFSBuild.Proj file.
Ideally. TFS should start 'DoMyBuild' target as I read. But it gives a error looking for 'EndToEndIteration' not defined. So, I believe it is still doing a DesktopBuild which I dont want. I want to use my custom target to kick start. Is this possible ?
Any help is very much appreciated.
Thanks, Mani
You problem is discussed here.
Make sure you have at least an EndToEndIteration target defined in your MSBuild project.
<Target Name="EndToEndIteration"
Condition=" '$(IsDesktopBuild)'!='true' "
DependsOnTargets="$(EndToEndIterationDependsOn)" />
Delphi 2009 uses build configurations. When you create a new project you have two default build configurations "Debug" and "Release".
Now I asked myself how to automate builds using MSBuild (which is supported by Delphi since version 2007).
You can start the "msbuild" command in the "RAD Studio Command Prompt" in some Delphi project directory and it will build the default build configuration (the last activated build configuration inside the Delphi IDE).
Now, I want to specify a certain (non-default) build configuration by a command line parameter.
The Delphi help asserts that the parameter is [/p:configuration=<configuration name>], which is wrong (Delphi 2009, Help Update 1)!
What is the right way?
Now, if you want to change the build configuration you have to add the parameter
/p:config=<BUILD_CONFIG_NAME>
For example:
C:\Projects\TestDelphiApp001>msbuild /target:Build /p:config=Release
or
C:\Projects\TestDelphiApp001>msbuild /target:Build /p:config=Debug
Copied from original "question"; note community wiki.
I tried this with Delphi XE. It didn't work until I figured out I needed to set the environment variables referenced by the .dproj file:
SET BDS=C:\Program Files (x86)\Embarcadero\RAD Studio\8.0
SET BDSBIN=C:\Program Files (x86)\Embarcadero\RAD Studio\8.0\bin
SET BDSAPPDATABASEDIR=BDS
msbuild myproject.dproj /target:Build /p:config=Release
I've had the same problem and found the solution:
Write /p:config instead of /p:configuration
Write "Release Build" or "Debug Build" (in double quotes) instead of Release or Debug
It did it for me.