| **Navigation:**  [[advanced topics 1.htm|Advanced Topics]] > Clarion Project System >====== MSBuild tasks ====== | [[clarion project system version 7.htm|{{btn_prev_n.gif|Previous page}}]][[advanced topics 1.htm|{{btn_home_n.gif|Return to chapter overview}}]][[common msbuild properties.htm|{{btn_next_n.gif|Next page}}]] | | || {{notebox.jpg|NoteBox.jpg}} To run MSBUILD.EXE from the command line, set an environment path to its location and the Microsoft //tasks.dll// and //tasks// file. Add this directory to the system path: c:\windows\microsoft.net\framework\v4.0.30319\ After you use generate your APP files either from the IDE or using [[clarioncl exe.htm|ClarionCL]] you can use MSBUILD to compile either individual projects or entire Solutions. You can pass any parameters supported by MSBUILD. For example to control whether to build in Debug or Release: 1. **set **ClarionPath** environment variable, i.e. set ClarionPath=C:\Clarion10\bin 2. run[[clarioncl exe.htm| ClarionCL]] to generate the required code 3. run MSBUILD to compile the .sln and set the desired configuration ! Builds all .APP files contained in the Solution: msbuild myProject.sln /p:Configuration=Debug or msbuild myProject.sln /p:Configuration=Release **.cwproj File Format** The .cwproj file is a standard MSBuild file in a format that allows the IDE to provide a graphical interface on top of the file. This file consists of properties and items that are passed to the CW and CWClean tasks. The following shows the properties and items in the .cwproj file, and which task parameter they map to. | __**Item/Property**__ | __**Item or Property**__ | __**CW Task Parameter**__ | __**CWClean Task Parameter**__ | | Compile | Item | Sources | | | FileDriver | Item | FileDrivers | | | Include | Item | Includes | | | Library | Item | Libraries | | | None | Item | CopyableFiles | | | ProjectReference | Item | References | | | Reference | Item | References | | | ApplicationIcon | Property | Icon | | | check_index | Property | CheckIndex | | | check_stack | Property | CheckStack | | | clarion_version | Property | Version | Version | | CopyCore | Property | CopyCoreFiles | | | Cpu | Property | CPU | | | DefineConstants | Property | Defines | | | GenerateMap | Property | MapFile | | | line_numbers | Property | LineNumbers | | | Model | Property | Model | | | OutputName | Property | TargetName | | | OutputPath | Property | TargetDir | | | OutputType | Property | TargetType | | | RedFile | Property | RedirectionFile | | | stack_size | Property | StackSize | | | Vid | Property | Vid | | Which task is invoked is dependent on the build target. If a Build is being performed (the default target), then the CW Task is invoked. If a Clean is being performed, then the CWClean Task is invoked. If a Rebuild is being performed, then both the CWClean Task and CW Task are invoked. **CW Task** Invokes the Clarion project system which produces executables (.exe), dynamic-link libraries (.dll), or code libraries (.lib). **Parameters** The following table describes the parameters of the **CW** task. | __**Parameters**__ | __**Description**__ | | **CheckIndex** | Optional **Boolean** parameter.If true, then compiler generates check code when array indexes are usedEquivalent to #pragma check(index=>value) in the legacy project system | | **CheckStack** | Optional **Boolean** parameter.If true, then compiler generates stack access checking codeEquivalent to #pragma check(index=>value) in the legacy project system | | **CopyableFiles** | Optional **ITaskItem[] **parameter.Specifies one or more files that should be copied to the destination directory.This list is only processed if **TargetType** is Exe | | **CopyCoreFiles** | Optional **Boolean** parameter.If true, the core DLLs will be copied | | **CPU** | Optional **String** parameter.Indicates which CPU the code is optimized for. Currently ignored. | | **Defines** | Optional **String** parameter.Specifies a list of defines set when building this project. This is a semi-colon ';' separated list of items in the format item=>value. As the .cwproj file is an MSBuild file, this list must use standard XML notation. So a list of 2 elements _ABCDllMode_=>on;_ABCLinkMode_=>off will look like<;defines>_ABCDllMode_=&gt;on%3b_ABCLinkMode_=&gt;off <;/defines>This is equivalent to #pragma define(define=>value;define=>value) in the legacy project system | | **FileDrivers** | Optional **ITaskItem[] **parameter.Specifies one or more File Drivers that should be linked into the project. | | **Icon** | Optional **String** parameter.Indicates the name of the file that contains the icon that Windows will associate with the Exe.Equivalent to #pragma link_option(icon => iconname) in the legacy project system | | **Includes** | Optional **String** parameter.Semi-colon ';' separated list of legacy project files to be included into this project.Equivalent to #include(projectFile) in the legacy project system | | **LibFile** | Optional **String** output parameter.Specifies the .lib file that was created by this project | | **Libraries** | Optional **ITaskItem[] **parameter.Specifies one or more .lib files that should be linked into the project.Equivalent to #pragma link (libfile) in the legacy project system | | **LineNumbers** | Optional **Boolean** parameter.If true, then line number information will be added to the MAP fileEquivalent to #pragma debug (line_num=>value) in the legacy project system | | **MapFile** | Optional **Boolean** parameter.If true, then line number information will be added to the MAP fileEquivalent to #pragma link_option (map=>value) in the legacy project system | | **Model** | Optional **String** parameter.Specifies the memory model. Valid values are Dll, Lib, and CustomDll | | **OutputFile** | Optional **String** output parameter.Specifies the .exe or .dll file that was created by this project | | **ProjectName** | Required **String** parameter.Specifies the name of the project file being built. Normally set to the built-in project property **MSBuildProjectFile** | | **RedirectionFile** | Optional **String** parameter.Specifies the redirection file to be used for this build.If not supplied, then the default redirection file is used based on the directory of the project and the **Version** parameter | | **References** | Optional **ITaskItem[] **parameter.Specifies one or more legacy or MSBuild project files that should be used to obtain .lib files that this project uses.Any project in this list will be built when you build this project. Any .lib file created by the referenced project will be added to the **Libraries** list. | | **RequiredDlls** | Optional **ITaskItem[] **output parameter.Specifies the list of dlls that this project depends on. | | **Sections** | Optional **String** parameter.Specifies which sections are to be active on start of the project.Normally set to the built in property **Configuration**.Controls which parts of the redirection file are active during the build.Can also be used to activate sections defined in the cwglobals.pi or solglobals.pi files. | | **Sources** | Required **ITaskItem[] **parameter.Specifies the list of source files to be compiled in this projectEquivalent to #compile (file) in the legacy project systemAlternatively can contain 1 .pr or .prj file. In this case that legacy project file is built. | | **StackSize** | Optional **Int** parameter.Specifies the size of the stack.Equivalent to #pragma link_option (stack=>value) in the legacy project system | | **TargetDir** | Optional **String** parameter.Specifies the directory where the target file will be created.If specified this overrides any settings in the redirection file. | | **TargetName** | Optional **String** parameter.Specifies the name of the exe, dll or lib being created by the project.This must be specified unless there is only 1 item in the sources list and this is a .prj or .pr file. | | **TargetType** | Optional **String** parameter.Indicates what type of binary is being created.Valid values are:'dll' - indicates that a .DLL file is being created'lib' - indicates that a .LIB file is being createdAnything else will be treated as 'exe' and a .EXE will be created. | | **Version** | Optional **String** parameter.Indicates which version of Clarion to use to build the project.Default is to use the current version of Clarion | | **Vid** | Optional **String** parameter.Indicates what debug support should be compiled into the .obj filesValid values are full, min, off. | **CopyableFiles Meta Data** Any item in the **CopyableFiles** list can optionally have the following Metadata elements | __**Element**__ | __**Description**__ | | **CopyToOutputDirectory** | Optional **String** element.Indicates if the file should be copied to the destination directory of the Exe file.If set to "always" then the file will always be copied.If set to "preservenewest" then the file will be copied only if it is newer than the file in the destination directory | **Libraries Meta Data** Any item in the **Libraries** list can optionally have the following Metadata elements | __**Element**__ | __**Description**__ | | **CopyToOutputDirectory** | Optional **String** element.Indicates if the file should be copied to the destination directory of the Exe file.If set to "always" then the file will always be copied.If set to "preservenewest" then the file will be copied only if it is newer than the file in the destination directory | | **DllLocation** | Optional **String** element.Only tested if **CopyToOutputDirectory** is not set to "always" or "preservenewest".Indicates where the dll that matches this library can be found.If not specified, then the dll is assumed to be in the format <;library_name>.dll and can be found via redirection. | | **CopyDllToOutputDirectory** | Optional **String** element.Only tested if **CopyToOutputDirectory** is not set to "always" or "preservenewest".Indicates when the dll that matches this library should be copied.If set to "always" then the dll will always be copied.If set to "preservenewest" then the dll will be copied only if it is newer than the dll in the desination directory. Otherwise it is copied if the CW Task parameter **CopyCoreFiles **is true. | **References Meta Data** Any item in the **References** list can optionally have the following Metadata elements | __**Element**__ | __**Description**__ | | **CopyReferencesToOutputDirectory** | Optional **String** element.Valid values are "Always", "Never", or "Default".Default value is "Default".Only applies to referenced .cwproj files.Indicates if referenced dlls should be copied to the output directory. A value of Default indicates that referenced dlls should be copied if **CopyCoreFiles** is true. | | **CopyToOutputDirectory** | Optional **Boolean** element.Default value is false.Only applies to referenced .cwproj files.If false, then files created by this project or flagged to be copied will not be added to the list of files to be copied. | | **Link** | Optional **Boolean** element.Default value is true.If the reference is a .cwproj file and **link** is false, then files created by this project or flagged to be copied will not be added to the list of files to be copied.If the reference is a legacy project file, then it is not included in the current build. | **Sources Meta Data** Any item in the **Sources** list can optionally have the following Metadata elements | __**Element**__ | __**Description**__ | | **check_index** | Optional **Boolean** element. | | | Indicates if index checking should be generated for this source file.Equivalent to /check(index=>value) in the legacy project system | | **check_stack** | Optional **Boolean** element.Indicates if stack checking should be generated for this source file.Equivalent to /check(stack=>value) in the legacy project system | | **CopyToOutputDirectory** | Optional **String** element.Indicates if the source file should be copied to the destination directory of the Exe file.If set to "always" then the source file will always be copied.If set to "preservenewest" then the source file will be copied only if it is newer than the file in the destination directory | | **Defines** | Optional **String** element.Specifies a list of defines set when compiling this source file. This is a semi-colon ';' separated list of items in the format item=>value. As the .cwproj file is an MSBuild file, this list must use standard XML notation. So a list of 2 elements a=>2;b=>3 will look like:<;defines>a=&gt;2%3bb=&gt;3 <;/defines>This is equivalent to /define(define=>value;define=>value) in the legacy project system | | **Line_num** | Optional **Boolean** element.Indicates if line numbers should be generated in the map for this source file.Equivalent to /debug(line_num=>value) in the legacy project system | | **To** | Optional **String** element.Indicates the name of the object file the source file should be compiled to.Equivalent to the #to option in the legacy project system | | **Vid** | Optional **String** element.Valid values are "full", "min", "off".Indicates what level of debug code to generate for this source file.Equivalent to /debug(vid=>value) in the legacy project system | **CWClean Task** Deletes all files created by a previous call to the **CW** task. This task relies on the <;projectnam>.FileList.xml file that is created by the CW task. **Parameters** The following table describes the parameters of the **CWClean** task. | __**Parameters**__ | __**Description**__ | | **ProjectName** | Required **String** parameter.Specifies the name of the project file being built. Normally set to the built-in project property **MSBuildProjectFile** | | **Sections** | Optional **String** parameter.Normally set to the built in property **Configuration**.Controls which parts of the redirection file are active during the clean up. | | **Version** | Optional **String** parameter.Indicates which version of Clarion to use during the clean up.Default is to use the current version of Clarion |