InvalidOperationException: 'The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine
When opening the Shapfile, I get this:
InvalidOperationException: 'The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine.'
Found a SO thread on it: https://stackoverflow.com/questions/1991643/microsoft-jet-oledb-4-0-provider-is-not-registered-on-the-local-machine
But installing that driver does not change anything for me, nor do I have any connectionStrings, as they talk about.
Running Win11, dotnet framework 4.7, VS 2022.
There are two ways to handle this. If you target your application at 32-bit (x86) then the JET driver should work. You can also install System.Data.OleDb and try the alternate connection string ConnectionStringTemplateAce in Shapefile.
Hello! Where does one set the connection string?
There is a constructor overload that takes the connection string as an argument, and there are two defined options for JET and ACE in Shapefile. The default is JET.
I guess this means that using this library in a .NET 7 application running on 64bit linux is not supported @abfo ?
Not something I've tried. You could install System.Data.OleDb and experiment with the connection string. I think that package should work on Linux.
Thanks for the suggestion, @abfo, but unfortunately System.Data.OleDb is not supported on Linux even though the package is available for .NET core/6/7/8. Getting "System.Data.OleDb is not supported on this platform" when on Linux.
For anyone else seeing this: I wasn't very good at researching when I first looked for Shapefile readers in .NET. Now I see that NetTopologySuite (which we actually already have in our project) supports reading Shapefiles through ShapefileDataReader.
Sorry to hear that, and glad you found a solution that works for you.