Altova MapForce 2023 Enterprise Edition

MapForce Command Line Interface

Home Prev Top Next

The general syntax of a MapForce command at the command line is:

 

MapForce.exe <filename> [/{target} [[<outputdir>] [/options]]]

 

Legend

The following notation is used to indicate command line syntax:

 

Notation

Description

Text without brackets or braces

Items you must type as shown

<Text inside angle brackets>

Placeholder for which you must supply a value

[Text inside square brackets]

Optional items

{Text inside braces}

Set of required items; choose one

Vertical bar (|)

Separator for mutually exclusive items; choose one

Ellipsis (...)

Items that can be repeated

 

<filename>

The mapping design (.mfd) or mapping project (.mfp) file from which code is to be generated. To generate code for the whole project, set the target /GENERATE (see description below) and enter the project path as <filename>, for example, MapForceExamples.mfp.

 

/{target}

Specifies the target language or environment for which code is to be generated. The following code generation targets are supported.

 

Target

Description

/COMPILE[:compileoptions]

Compiles a mapping to a MapForce Server execution file (.mfx). Optionally, the following options can be supplied, delimited by a comma:

JDBC

Transforms all database connections to JDBC using the JDBC driver and the database URL defined in the Database Component Settings dialog box, see also Database Component Settings.

NOXMLSIGNATURES

Suppresses the generation of digital signatures in the MapForce Server Execution file (note that digital signatures are not supported by MapForce Server).

 

/GENERATE

Generates project code for all mappings in the project file using the current folder settings, see Managing Project Folders. If you select this target, make sure to supply a MapForce project (.mfp file) as <filename>.

/XSLT

Generates XSLT 1.0 code.

/XSLT2

Generates XSLT 2.0 code.

/XSLT3

Generates XSLT 3.0 code.

/XQuery

Generates XQuery code.

/JAVA

Generates Java code.

/CS

Generates C# code. This command also optionally allows setting specific options for code generation, namely:

 

/CS[:{VS2010|VS2013|VS2015|VS2017|VS2019}]

 

VS2010

Visual Studio 2010

VS2013

Visual Studio 2013

VS2015

Visual Studio 2015

VS2017

Visual Studio 2017

VS2019

Visual Studio 2019

 

If no Visual Studio version is specified, code will be generated using the Visual Studio version defined in the code generation options, see Code Generator Options.

/CPP

Generates C++ code. This command also optionally allows setting specific code generation options, namely:

 

/CPP[:{VS2010|VS2013|VS2015|VS2017},{MSXML|XERCES3},{LIB|DLL},{MFC|NoMFC}]

 

The first option group sets the target Visual Studio version. Valid values:

 

VS2010

Visual Studio 2010

VS2013

Visual Studio 2013

VS2015

Visual Studio 2015

VS2017

Visual Studio 2017

VS2019

Visual Studio 2019

 

The second option group specifies the XML library targeted by the generated code. Valid values:

 

MSXML

Generate code for MSXML 6.0

XERCES3

Generate code for Xerces 3

 

The third option group specifies whether static as opposed to dynamic libraries should be generated. Valid values:

 

LIB

Generate static LIB libraries

DLL

Generate DLL libraries

 

The fourth option group specifies whether code should be generated with or without MFC support. Valid values:

 

MFC

Enable MFC support

NoMFC

Disable MFC support

 

If the options above are not specified, code will be generated using the Visual Studio version defined in the code generation options, see Code Generator Options.

 

<outputdir>

Optional parameter which specifies the output directory. If an output path is not supplied, the current working directory will be used. Note that any relative file paths are relative to the current working directory.

 

When target is /GENERATE and the <outputdir> parameter is not set, the code generation language, as well as the output path of each mapping, are supplied by the settings defined for each folder inside the project, see Managing Project Folders.

 

When target is /GENERATE and the <outputdir> parameter is set, the <outputdir> value supplied at the command line takes precedence over the output directory defined at the root project level. It does not take precedence, however, over the code generation settings defined at each folder inside the project.

 

/options

The /options are not mutually exclusive. One or more of the following options can be set.

 

Option

Description

[/MFXVERSION[:<version>]

This option is applicable if the target is /COMPILE. It compiles the MapForce Server Execution (.mfx) file for a particular version of MapForce Server. You can supply as value any version of MapForce Server, starting with 2013r2 onwards, up to the current MapForce version. See also Compiling mappings for a specific MapForce Server version.

/GLOBALRESOURCEFILE <filename>

This option is applicable if the mapping uses Global Resources to resolve input or output file or folder paths, or databases. For more information, see Altova Global Resources.

 

The option /GLOBALRESOURCEFILE specifies the path to a Global Resource .xml file. Note that, if /GLOBALRESOURCEFILE is set, then /GLOBALRESOURCECONFIG must also be set.

/GLOBALRESOURCECONFIG <config>

This option specifies the name of the Global Resource configuration (see also the previous option). Note that, if /GLOBALRESOURCEFILE is set, then /GLOBALRESOURCECONFIG must also be set.

/LIBRARY <libname> (...)

Use together with a code generation target language to specify additional function libraries. This option can be specified more than once to load multiple libraries. See also Managing Function Libraries.

/LOG <logfilename>

Generates a log file at the specified path. <logfilename> can be a full path name, for example, it can include both a directory and a file name. However, if a full path is supplied, the directory must exist for the log file to be generated. If you specify only the file name, then the file will be placed in the current directory of the Windows command prompt.

 

Remarks

Relative paths are relative to the working directory, which is the current directory of the application calling MapForce. This applies to the path of the .mfd filename, .mfp filename, output directory, log filename, and global resource filename.

Do not use the end backslash and closing quote at the command line (for example, "C:\My directory\"). These two characters are interpreted by the command line parser as a literal double quotation mark. Use the double backslash \\ if spaces occur in the command line and you need the quotes ("c:\My Directory\\"), or try to avoid using spaces and therefore quotes at all.

 

Examples

1) To start MapForce and open the mapping <filename>.mfd, use:

 

MapForce.exe <filename>.mfd

 

2) To generate XSLT 2.0 code and also create a log file with the name <logfilename>, use:

 

MapForce.exe <filename>.mfd /XSLT2 <outputdir> /LOG <logfilename>

 

3) To generate XSLT 2.0 code taking into account the global resource configuration <grconfigname> from the global resource file <grfilename>, use:

 

Mapforce.exe <filename>.mfd /XSLT2 <outputdir> /GLOBALRESOURCEFILE <grfilename> /GLOBALRESOURCECONFIG <grconfigname>

 

4) To generate a C# application for Visual Studio 2015 and output a log file, use:

 

MapForce.exe <filename>.mfd /CS:VS2015 <outputdir> /LOG <logfilename>

 

5) To generate a C++ application using the code generation settings defined in Tools | Options, and output a log file, use:

 

MapForce.exe <filename>.mfd /CPP <outputdir> /LOG <logfilename>

 

6) To generate a C++ application for Visual Studio 2015, MSXML, with static libraries, MFC support, and no log file, use:

 

MapForce.exe <filename>.mfd /CPP:VS2015,MSXML,LIB,MFC

 

7) To generate a C++ application for Visual Studio 2015, Xerces, with dynamic libraries, no MFC support, and a log file, use:

 

MapForce.exe <filename>.mfd /CPP:VS2015,XERCES,DLL,NoMFC <outputdir> /LOG <logfilename>

 

8) To generate a Java application and also output a log file, use:

 

MapForce.exe <filename>.mfd /JAVA <outputdir> /LOG <logfilename>

 

9) To generate code for all mappings in the project, using the language and output directory defined in the folder settings (of each folder inside the project), use:

 

MapForce.exe <filename>.mfp /GENERATE /LOG <logfilename>

 

10) To generate Java code for all mappings in the project file, use:

 

MapForce.exe <filename>.mfp /JAVA /LOG <logfilename>

 

Note that the code generation language defined in the folder settings are ignored, and Java is used for all mappings.

 

11) To supply input and output files at the command line for a previously compiled Java mapping, use:

 

java -jar <mappingfile>.jar /InputFileName <inputfilename> /OutputFileName <outputfilename>

 

The /InputFileName and /OutputFileName parameters are the names of special input components in the MapForce mapping that allow you to use parameters in command line execution (see Supplying Parameters to the Mapping).

 

12) To compile a mapping to a MapForce Server execution file, for MapForce Server version 2023, and suppress XML signatures:

 

MapForce.exe <filename>.mfd /COMPILE:NOXMLSIGNATURES <outputdir> /MFXVERSION:2023 /LOG <logfilename>

 

© 2017-2023 Altova GmbH