MapWinGis VB.Net without install

Hello everyone
I have created a VB.Net application with MapWinGis. The program works without a problem when running on the development machine. When I run it on a seperate machine it works without a problem if I have MapWinGis installed on the computer. However, I would like to have everything embedded in the software, so user do not have to install a seperate software. They only have to open the exe file. There are two dll files in the build directory but as far as I can read, this is not enough.

Is there any solution to make the application stand-alone and not requirering any form of installation?
Thanks in advance!

Hello @Nissephar

Yes, you can do this. It’s called registration-free COM, and Visual Studio makes it pretty easy. Note that the OCX should still be registered on the development machine, but it will not have to be registered on the distribution machines.

  1. In the project properties, go to the References tab.
  2. Find the MapWinGIS map components, and in the properties, find Isolated. This defaults to False, but you want to set it to True. By isolating the component, Visual Studio will inspect the exported Types, and generate a manifest file (named <appname>.exe.manifest). After rebuilding your app, you should see this new file alongside your executable.
  3. The two files you say are in the build directory are probably the interop files for the OCX. You will still need those, but you also have to copy the MapWinGIS OCX and all of it’s dependencies into your executable directory. Depending on what you specified when you installed the OCX, these might be located in c:\dev\MapWinGIS. You will have to distribute all of these files along with your executable, the interops, and the manifest file.

If you want to test on your development machine, you can temporarily unregister the OCX.

Hopefully I didn’t overlook something. Let me know if this doesn’t work.

Regards,
Jerry.

Hello @jerryfaust

Thank you very much for your reply. However, when I try to isolate the component and copy all the files from c:\dev\MapWinGIS the program doesn’t work. Visual Studio goes direcly into break mode when trying to debug the software. I get the following error message:
System.InvalidOperationException: An error occurred creating the form. See Exception.InnerException for details.
Error is: Not Valid Win32 Application. (Exception from HRESULT: 0x800700C1)

Do you know what the reason for this error is?

So I tried this on a small test app, and the one other thing I had to change was to set the Target CPU as x86 rather than AnyCPU. See if that solves the problem for you.

Regards.

Thank you very much!!! It worked!

1 Like

This topic was automatically closed after 5 days. New replies are no longer allowed.