Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET Error: The dependency 'Microsoft.Office.Interop.Excel' could not be found

My colleague has written a DLL which drives Excel.
When I reference his DLL in my .NET app, I get a warning:

The dependency 'Microsoft.Office.Interop.Excel' could not be found. 

My app will compile.
However, when I get to the bit that uses my colleague's DLL to access Excel, an exception is thrown, with the message above.

We should have identical setups: Windows XP Pro SP3, VS2003, .NET 1.1, Office 2003

My problem seems similar to this question, but I don't know if it's the same.

Any help or suggestions gratefully received!

Update:

Thanks for answers so far!

I have not added an explicit reference to Microsoft.Office.Interop.Excel.
Surely I shouldn't have to?
However: When I tried to add this reference, I cannot find Microsoft.Office.Interop.Excel in the Add Reference dialog.

Presumably this means that I am missing a DLL?
... But I don't understand how that could happen?!

Update (fixed):

@ConcernedOfTunbridgeWells has the answer that fixed this for me: installing the Primary Interop Assemblies.

like image 288
AJ. Avatar asked Nov 12 '08 15:11

AJ.


1 Answers

You may need to install the Primary Interop Assemblies for Office, which can be downloaded from Here. Depending on the order that you install Visual Studio and Office they may not be installed by default.

like image 181
ConcernedOfTunbridgeWells Avatar answered Sep 30 '22 17:09

ConcernedOfTunbridgeWells