Please enable JavaScript to view this site.

Altova MapForce 2020 Enterprise Edition

This example illustrates how to import into MapForce a custom .NET DLL assembly created in C#. The source code of this sample is available at the following path: <Documents>\Altova\MapForce2020\MapForceExamples\C#\Format. The .dll assembly file that will be imported into MapForce is in the ..\bin\Debug directory. You can also open the solution .sln file in Visual Studio and compile a new .dll file using the latest .NET Framework version.


Note:To run this example, .NET Framework 2.0 or later must be installed on your computer. If it's not already enabled, you can enable it from Control Panel > Programs and Features > Turn Windows features on and off > .NET Framework <version>.

To import the .NET assembly file:

1.Click the Add/Remove Libraries button at the base of the Libraries window. The Manage Libraries window opens.


2.Do one of the following:


To import functions as a local library (in the scope of the current document only), click the Add button under the current mapping name.

To import functions as a global library (at program level), click the Add button adjacent to Global Library Imports.


Note:When you import a library locally, you can set the path of the library file to be relative to the mapping file. With globally imported libraries, the path of the imported library is always absolute.


3.Browse for the Format.dll file from the ...\MapForceExamples\C#\Format\bin\Debug\ directory. A message appears informing you that a new library has been added. The imported library is now visible in the Libraries window.


If you do not see the newly imported library in the Libraries window, make sure that the transformation language is set to C#. To add the function to the mapping, drag it from the Libraries window onto the mapping area, see also Add a Function to the Mapping.

To preview the mapping output:

1.Open the FormatNumber.mfd file available in the ...\MapForceExamples\C# folder. This is an example mapping that already imports the .dll library mentioned above.

2.Click the Output button to see the result of the mapping.


To run the mapping from a custom C# application:

1.On the File menu, click Generate Code In | C#.

2.Select a target directory where the code should be generated, and click OK.

3.Build the application with Visual Studio, and run the generated console application (see also Generating C# code).

© 2020 Altova GmbH