When deploying and registering a .Net
Excel.dll
on another computer, I get an error Can\'t add a reference to the specified file
when
I recently encountered and managed to solve exactly this problem - though I can't claim to understand exactly why my solution worked.
Both my systems are running Windows 7 x64. One has Excel 2010, the other Excel 2007.
All the C# assemblies are set to "Platform Target: Any CPU". The primary assembly is set to "Register for COM Interop". The whole thing is installed using an MSI created by a Visual Studio Installer project.
I found that if I set the Visual Studio Installer project "Target Platform" to "x64", then it works in Excel 2010, but not in Excel 2007. Conversely, if I set the Visual Studio Installer project "Target Platform" to "x86", it works in Excel 2007 but not in Excel 2010.
Sadly, I'm not in a position to test both Excel versions on the same machine at the same time - but at least this might get it working for you!
You need to register the type library for excel to see your dll in References.
i.e. regasm.exe excelDll.dll /tlb:excelDll.tlb
Mark.