Programs run in VS debug but not when installed

Rudolfsson, Carin 0 Reputation points

I have a program, in C#, that need to fetch data from an Access database. The program runs ok when debugging in VS 2022 17.5.4. I make a msi-file with Wix and include System.Data.OleDb and I can see that the dll is installed in the same folder as my program. Still when running the program I get the error that the program can't find the dll.

.NET Version: 6.0.16 System.IO.FileNotFoundException: Could not load file or assembly 'System.Data.OleDb, Version=, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. File name: 'System.Data.OleDb, Version=, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

I have tried make it as a batch program and also changed it to windows forms. Same problem with both. Tried to find answer but only find with earlier versions of .net and oledb.
Happy for any help on this issue!
Thanks Carin

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
32,710 questions
{count} votes