Altova MapForce 2024 Professional Edition

Generating code from a mapping

Home Prev Top Next

To generate C# code from a mapping design file (.mfd):


1.If you haven't done so already, create a new mapping or open an existing one in MapForce.

2.Select C# as mapping transformation language. To do this, either click the cg-csharp-lang toolbar button or select the menu command Output | C# (Sharp).

3.Set or change the C# code generation options as described in Selecting the target platform.

4.Select the menu command File | Generate code in | C# (Sharp). You are now prompted to select a target directory.

5.Browse for the directory of your choice (for example, "C:\codegen\ConvertProducts") and click OK.


The code generation outcome is displayed in the Messages window, for example:


Optionally, click the link in the Messages window to open the generated solution in Visual Studio.


Note that, if you chose to generate code targeting .NET 5.0, .NET 6.0, or .NET Core platforms, you need the respective SDKs and a compatible Visual Studio version. For the download package applicable to your operating system and platform, refer to the Microsoft website (


To double-check the project's target framework from Visual Studio, right-click the "Mapping" project in the Solution Explorer, select Properties, and observe the value displayed in the Target Framework drop-down list, for example:


The default name of the generated application is Mapping. Optionally, you can change this and other settings before generating code, from the Mapping Settings dialog box.

© 2017-2023 Altova GmbH