Developer forum

Forum » Development » NuGet OleDB issue

NuGet OleDB issue

Alex Guo
Reply

Hi,

We are trying to upload a custom DLL that is using the System.Data.OleDb NuGet package. This DLL is designed to make bulk orders with the help of an Excel file - the Excel file is read by the OleDB NuGet package. However, instead of working correctly, I get this error and I don't know what's going wrong:

Error Message

An error occurred while attaching module (Dynamicweb.Frontend.Content)

System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.OleDb, Version=9.0.0.6, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
File name: 'System.Data.OleDb, Version=9.0.0.6, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
   at DW10.UploadCartFromExcel.Helpers.ExcelFileParser.PrepareProductDictionaryFromExcelFile(Template formTemplate, String fileName, String file, String productNumberColumnNumberName, String quantityColumnNumberName, Dictionary`2 dctIds)
   at DW10.UploadCartFromExcel.Frontend.GetModuleContent()
   at Dynamicweb.Frontend.Content.GetModuleOutput(Paragraph paragraph, PageView pageview)
I've been getting this error everytime, except for once on our demo environment and the bulk orders worked. After updating to swift 2 and uploading the .dll again we get these errors again.
 

What We've Tried

  • Added/updating the System.Data.OleDb NuGet package to our project on DW10
  • Built the project successfully with the OleDb NuGet
  • The bin folder only contains our DLL, .pdb file, and .deps.json (no runtime folder or additional dependencies)

 

  • .NET 8
  • Dynamicweb 10​

Any guidance would be greatly appreciated!

Thanks in advance for your help.


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Alex

As I understand it, System.Data.OleDb relies on 3rd party components.

Your machine/server must have the following installed:

  • Microsoft Access Database Engine (for Excel .xls/.xlsx reading)

  • The 32-bit or 64-bit OLE DB driver, matching your app’s architecture

Without these, you’ll get:

  • System.IO.FileNotFoundException

  • Or COM-related errors like "Provider not registered..."

Those dependencies are not installed on our Cloud - nor will they be.

OleDb is really old and not really made for .net core / .net 8 environments. It will never work on e.g. Mac and Linux which is supported for .NET 8 and Dynamicweb.


You should use something else - e.g. https://github.com/ExcelDataReader/ExcelDataReader or https://github.com/ClosedXML/ClosedXML both MIT licensed and running on .net 8, ExcelDataReader being the one with least dependencies and looks most stable.

I am currently looking into supporting a feature like the one you are dealing with here - feel free to send me an example of your Excel sheet and maybe event the module you have at hand, and I will see if it can be added as a standard feature.

Votes for this answer: 1
 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Also I just noticed you reference 

System.Data.OleDb, Version=9.0.0.6

Dynamicweb 10 is still .NET 8

You should try to install it like this:

dotnet add package System.Data.OleDb --version 8.0.1

So if it does wotk opposed to what I just wrote, you should try that.

https://www.nuget.org/packages/System.Data.OleDb/8.0.1

 
Alex Guo
Reply

Thanks for the detailed explanation.

What I don’t fully understand is that this used to work before we updated our demo shop,  the bulk order functionality was working fine back then.

We originally got this feature from someone at Dynamicweb named Igor. Our goal is to customize this functionality further to fit our needs.

I’ll give ExcelDataReader a try as suggested. In the meantime, I’m happy to send over the source code of this project and an example Excel file if that helps you evaluate whether this could be added as a standard feature.

Let me know how you'd like me to send it.

 

You must be logged in to post in the forum