I am working on a C# VSTO Excel Addin, which will be called from some excel VBA. Therefore I must:
- Register for COM interop, and
- Make assembly COM-Visible
The register does not break anything, but making the assembly COM visible produces the following two errors:
Error The assembly "C:\Users\...\ExcelInterop.dll" could not be converted to a type library. Type library exporter encountered an error while processing 'ExcelInterop.ThisAddIn, ExcelInterop'. Error: Error loading type library/DLL. ExcelInterop
Error The assembly 'Microsoft.Office.Tools.Common.v4.0.Utilities, Version=10.0.0.0, Culture=neutral, PublicKeyToken=...' is not registered for COM Interop. Please register it with regasm.exe /tlb. ExcelInterop
It works fine if I create a normal class library project, so I am guessing it has to do with ThisAddin.cs
, which links the C# to excel worksheets. Note, I have not changed ThisAddin.cs
at all from the boilerplate which is generated.
What am I trying to do?
From my VSTO Excel Addin, I must import/export some excel data and send it to a business API (which cannot be accessed from the VBA Excel addin). However, the VBA provides the UI for the client (among other things), which is why I cannot just rewrite the entire VBA addin in C#.