Please enable JavaScript to view this site.

Altova MapForce 2022 Professional Edition

Code Generator > Generating C# code

Building .NET 5 and .NET Core projects

Scroll Home Prev Top Next More

To build and run the generated .NET Core 3.1 and .NET 5.0 solution, you must have the respective SDK installed. For the download package applicable to your operating system and platform, refer to the Microsoft website (https://dotnet.microsoft.com/download). After downloading and installing the required package, yon can easily view the installed SDKs by entering the following command at the command prompt:

 

dotnet --list-sdks

 

If you have the .NET Core 3.1 or .NET 5.0 SDK, you can proceed to building the generated code, either at the command line or in Visual Studio. If using Visual Studio, note that, at the time of this writing (December 2020), the .NET Core 3.1 and .NET 5.0 SDKs are compatible with Visual Studio 2019 (v16.7).

 

Building at the command line

To build the generated code at the command line:

 

1.Open a command prompt window and change directory to the one where the mapping code was generated. For example, if you selected C:\codegen\ConvertProducts as target directory and the default mapping settings, run:

 

cd C:\codegen\ConvertProducts

 

2.Run the following command:

 

dotnet build Mapping\Mapping.sln --no-incremental --configuration Release --verbosity normal --output Mapping\bin\release

 

Note:        The path to the mapping solution and its name may be different if you have changed the Application Name property from the Mapping Settings dialog box.

 

The outcome for a successful build could be similar to the one below:

 

cg-netcore-cli-build

 

Building with Visual Studio

To build the generated code in Visual Studio:

 

1.Double-click Mapping.sln (or the respective custom solution name) to open it in Visual Studio.

2.On the Build menu, click Configuration Manager.

3.Select the required build configuration (Debug, Release) and solution platform (x64, x86, Any CPU).

4.On the Build menu, select Build Solution (Ctrl+Shift+B).

 

Running the generated program

After you build the generated code, a Mapping.exe (or a program with a custom name if configured) is produced in the project's output directory. The path of the output directory depends on the build configuration you have chosen earlier (Debug, Release).

 

If you build the generated code on Linux, the generated executable will be called simply Mapping, without any extension.

 

On Windows, you can execute the program by double-clicking the executable in Windows Explorer or by calling the executable from a command prompt window. On other platforms, you will need to call the executable from the terminal with a command like:

 

./Mapping

 

Note that, if the mapping has references to any input or output files on the disk, the program will execute successfully only if all the paths can be resolved. For example, if you configured the mapping so that a component should look for some input file in the same directory using a relative path, then the respective file must be present in the program's execution directory. For information about handling paths at mapping design time, see Using Relative and Absolute Paths.

© 2015-2021 Altova GmbH