Atmel Studio 7 command line build - define symbols on command line - atmelstudio

I am using the following command to build an atmel studio project on the command line:
AtmelStudio.exe C:\blahblah\solution.atsln /rebuild DEBUG /project PROJNAME /out output.txt
I would like to define symbols and override the values defined in the project's .cproj file, so that I do not need to define many different configurations. Is this possible, or do I need to use some other tool?

You need to use "/projectconfig".
/projectconfig Specifies the project configuration to build or deploy.
Must be used with /project

Related

How to copy OpenCV DLL files into cmake debug/release folder?

I need to copy
C:\opencv-3.4.0.-opencl\bin\Debug\*.dll =>
myproj\build\bin\Debug\*.dll
and also
C:\opencv-3.4.0.-opencl\bin\Release\*.dll =>
myproj\build\bin\Release\*.dll
I'd like to do it in one command for Build/Release if possible.
You can copy files on a post-build command. A step through tutorial can be found here.
The basic concept is that you can use batch file commands, as a post-build step in Visual Studio to do basically anything you want as you build.
A further tutorial can be found here
For CMAKE
The easiest way is to follow the advice above but instead of putting it in the post-build options in VS just add a custom command
You can try using CPack to handle multiple configuration at one go. See an example in the following tutorial
https://cmake.org/cmake/help/latest/guide/tutorial/index.html#packaging-debug-and-release-step-12
By default, CMake’s model is that a build directory only contains a
single configuration, be it Debug, Release, MinSizeRel, or
RelWithDebInfo. It is possible, however, to setup CPack to bundle
multiple build directories and construct a package that contains
multiple configurations of the same project.
Then you will need to use either of the following method for each configuration to copy the files you need
configure_file
https://cmake.org/cmake/help/latest/command/configure_file.html
or
add_custom_command
https://cmake.org/cmake/help/latest/command/add_custom_command.html
Here is an example from reddit
https://www.reddit.com/r/cmake/comments/gmewhu/copy_one_file_in_src_directory_to_build_directory/
# Copy <filename> to build directory
set(copy_source_dir "${CMAKE_SOURCE_DIR}/src/<path>")
set(copy_dest_dir "${CMAKE_BINARY_DIR}/Build/<path>/$<CONFIG>")
set(copy_file_name "<filename>")
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${copy_dest_dir}
)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${copy_source_dir}/${copy_file_name}" "${copy_dest_dir}/${copy_file_name}"
COMMENT "Copying ${copy_file_name} to build directory"
)

TFS 2018 Build (MSBuild) Multiple Project Error

I am in the process of converting an old TFS XAML build definition to the new build mechanism in TFS2018. In the old definition i was able to build multiple projects by filling in the Projects to build items in default build template and separate the projects with a "," comma.
$/WMS/Dev/sekoWMS/DPURevisionUpdater/DPURevisionUpdater.csproj,$/WMS/Dev/sekoWMS/DesktopApp/SEKOWMS/SEKOWMS.csproj
I have a new build in TFS 2018 and when I specify the same arguments in the solution line of the "build solution task", I get the following compiler error:
"C:\agent_work_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.120.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -latest -format json
"C:\agent_work_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.120.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\msbuild.exe" "C:\agent_work\3\s\Dev\Dev\sekoWMS\DPURevisionUpdater\DPURevisionUpdater.csproj,$\WMS\Dev\sekoWMS\DesktopApp\SEKOWMS\SEKOWMS.csproj" /nologo /nr:false /t:"Clean" /dl:CentralLogger,"C:\agent_work_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.120.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=58de9b3f-5678-49d1-8fd4-e40a7fda7f3f|SolutionDir=C:\agent_work\3\s\Dev\Dev\sekoWMS\DPURevisionUpdater\DPURevisionUpdater.csproj,$\WMS\Dev\sekoWMS\DesktopApp\SEKOWMS"*ForwardingLogger,"C:\agent_work_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.120.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /t:UpdateRevision /target:publish /property:PublishDir="\harmonywebdev.admin.sekoww.com\SEKOApps\sites\Downloads\SEKOWMSUtilityDev\" /property:InstallURL="http://harmonywebdev.admin.sekoww.com:9300/SEKOWMSUtility...
MSBUILD : error MSB1009: Project file does not exist.
Switch: C:\agent_work\3\s\Dev\Dev\sekoWMS\DPURevisionUpdater\DPURevisionUpdater.csproj,$\WMS\Dev\sekoWMS\DesktopApp\SEKOWMS\SEKOWMS.csproj
Process 'msbuild.exe' exited with code '1'.
Is there a way to specify multiple projects (from different) directories so that they compile correctly?
New build system doesn't support comma to separate the projects, it only supports Wildcard. Including #Daniel's suggestions, you could also try the steps below:
First, map all projects that you want to build:
Then, specify **\*.csprojin the build task:
Here are some options:
Use a solution file
Use multiple build steps
Create your own custom msbuild .proj file

Error While Creating Build

I have TFS 2010 and for one of the team project I have created the build definition (used default build template) and added the solution of one of the project. But when try to create build getting the following error:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets
(902): The command "if Debug == Debug copy
"C:\Builds\14\\\Sources\ServerObjects..\SharedInterfaces\bin\debug*.dll"
"C:\Builds\14\\\Sources\ServerObjects..\ServerObjects\bin\debug"" exited with
code 1.
I think you maybe has wrong folder structure on the source control, see my answer on similar question here
teambuilding and deploying a dll (e.g. wpftoolkit.extended.dll)
TeamBuild overrides the output folder so the bin\debug (or bin\release) folder won't exist. It collates the output into Binaries.
For your custom build step use the obj folder instead of bin as that'll be the same under both TeamBuild and the local machine build.

Is it possible to run the command line compiler with selected build configuration in Delphi XE2?

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)

Delphi MSBuild Build Configurations From Command Line

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.

Resources