judero01col / GMap.NET

GMap.NET Windows Forms & Presentation is an excellent open source, powerful, free and cross-platform .NET control. Allows the use of routing, geocoding, directions and maps from Google, Yahoo!, Bing, OpenStreetMap, ArcGIS, Pergo, SigPac, Yendux, Mapy.cz, Maps.lt, iKarte.lv, NearMap, HereMap, CloudMade, WikiMapia, MapQuest and many more.
Other
458 stars 200 forks source link

Cannot Create an instance of GMapControl - WPF Application Error #50

Open SaiBalaji202 opened 5 years ago

SaiBalaji202 commented 5 years ago

When I try to add GMapControl to my WPF Application, I'm getting an error saying "Cannot Create an instance of GMapControl" I'm also getting the following error message Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found.

How to solve this issue? I want to use GMap in my WPF application Capture

KlaLeu commented 5 years ago

Hallo, install with nuget the "System.Data.SQLite.Core" check the "bin" directory in the directories "x86" and "x64" which contains dll "SQLite.Interop.dll". This should happen when deploying the application.

SaiBalaji202 commented 5 years ago

Hi, At the time of installing GMap itself, SQLite.Core also gets installed. I also checked 'x86' and 'x64' directories. They also contain the SQLite.Interop.dll

Still, I'm getting the same error. Could you please help me with that?

xxJohnxx commented 5 years ago

Same problem. Any solution would be appriciated!

KlaLeu commented 5 years ago

Hi, I had this error synonymous and by downloading and integration of the nuget package has it works for me then. I once attached a minimal test project. I hope that helps solve the problem.

GMapTestCSharpMin.zip

xxJohnxx commented 5 years ago

Hi KlaLeu, Thanks for the example project! However, it is in WinForms, which works well on my end.

I get the SQLite.Interop.dll error when using WPF (Windows Presentation Foundation). Same for SaiBalaji202 as it seems according to his first post.

Do you have any experience with that, regarding the specific problem?

VISHAL1204 commented 5 years ago

Hi KlaLeu, Please try for WPF project and Update.

KlaLeu commented 5 years ago

Hi, The problem also exists with the master downloaded here. It seems that there is a problem with the MapControl in the WPF Designer. This can be avoided by building the WPF form exclusively in xaml. I did that in the attached mini project and it works. WPFErrorInDemo TestWPF_GMapMin.zip

Sorry, I have no experience in WPF because I work exclusively in the Windows Forms area and .Net Microframework https://kleuthold.wordpress.com/ area.

JustABearOz commented 5 years ago

I solved this issue by by changing the build from Any CPU to x64.

Dunge commented 4 years ago

+1

I just realized this project was still maintained (was using the radioman github stuck at 1.7.5) so I decided to update our project to the latest release.

Seems like application targeting .NET4 and Any CPU have a problem with loading SQLite dll. Switching my application to x64 works, but I would really like to prevent forcing a x64 OS and keep "Any CPU" functional. Any idea how we could fix that?

Edit: Nevermind, Adding the System.Data.SQLite nuget in my project fixed it. It downloaded both x86 and x64 dll in different folders and it seems to be working.

zgabi commented 4 years ago

Please try to add this line to your csproj: <RuntimeIdentifier>win-x86</RuntimeIdentifier>

For me it works with AnyCPU Prefer 32bit=True, .NET 4.0 target