Running an Integrated Mapping application from a user specified Windows folder using MapInfo Pro

Products affected:  MapInfo Pro
If you want to run an Integrated mapping application from a specific directory (other than the MapInfo Professional installation directory) then you will need to make some changes to the application. Below are the list of changes required, these changes are based on Integrated mapping Wpf sample but similar changes can be done for an Integrated Mapping application created in VB.Net , WinForms or MFC.

1.) Make sure you have defined your own entry point in your wpf/winforms application instead of using the auto generated one.

2.) Update the assembly reference 'Copy local' property to 'True' for MapInfo.Application.dll, MapInfo.Controls.dll, MapInfo.Types.dll, MapInfo.StyleResources.dll and miadm.dll in your project.

3.) Before calling the MapInfoCore.StartUp method set the dll directory for the application to MapInfoPro installation directory. Using the below win32 api in c#.

Pinvoke signature of API is. [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] static extern bool SetDllDirectory(string lpPathName);

In below example, we have MapInfoPro installed in default location “C:\Program Files\MapInfo\Professional\”.

[STAThreadAttribute] public static void Main(string[] args) { // Set Pro installation directory as Dll directory SetDllDirectory(@"C:\Program Files\MapInfo\Professional\"); // Startup the MapInfoCore MapInfoCore.StartUp(args); var app = new App(); app.Run(new MainWindow()); }

4.) Copy over the acPDFCreatorLib.Net.dll, CSYSInfo.xml, Fdo.dll, FDOCommon.dll, FDOGeometry.dll, LEADTOOL.RHX, MAPINFOPRO.MNU, MAPINFOW.PRJ, midlfdo.dll, midlOCI.dll, midlodbc.dll, mirasteru.dll, Syncfusion.Shared.MVVM.Wpf.dll, Xalan-C_1_11.dll, XalanMessages_1_11.dll and xerces-c_3_1.dll from MapInfoPro installation directory to the integrated mapping application output directory.

After doing the above changes you will be able to run the application from a directory other than MapInfo Professional's installation directory.
UPDATED:  December 3, 2019