Reputation: 11
I have a .NET 8.0 project that I've upgraded from .NET Framework 4.8.1. In my project, I've been using the Ole Db data providers for an access database. However, when I add a reference to System.Data.OleDb, I get a runtime error when trying to fill the data adapters from the access database file. The error is "System.Data.OleDb is not supported on this platform.". Though, according to nuget and .NET API documentation, it says that .NET 8.0 supports it, so what am I missing?
System.Data.OleDb Dependencies:
I have the Microsoft Access Database Engine 2010 installed, and I've tried using the Microsoft.Windows.Compatibility package and that also causes the same runtime error. I know System.Data.OleDb is not cross-platform, however even with my target framework set to .NET 8.0, I still only expect my application to function on Windows.
Upvotes: 0
Views: 748
Reputation: 11
I resolved my issue...
The System.Data.OleDb.dll that was placed in the 'OutDir' in VS from building ended up not being on the correct runtime even though my target framework was net8.0-windows. Copying the System.Data.OleDb.dll from 'OutDir'\runtimes\win\lib\net8.0\System.Data.OleDb.dll to my executing directory resolved the error mentioned in my question. Now I can continue to use my access database in .NET 8.0.
Hopefully this can help the next person who has this problem.
Upvotes: 1