2
votes

I am using Excel Interop in a SSIS Script task on a server with Excel 2007 installed.

Since a few days, errors appear when I try to open the script task. Whenever I open the code, the references to Interop are marked with a yellow warning sign and the namespace cannot be referenced. I cannot add it again via "Add References", and when I try to add Excel Object Library in the COM Tab, it is also added with yellow warning signs (I couldn't find an error message for that).

However, when I don't save the changes and just run the whole project, it works without problems. Interop therefore seems to work, but it is somehow not found in Visual Studio. I tried to install the PrimaryInteropAssemblies again, without success. The interop assembly is still found under c:\windows\assembly. The strange thing there is, that there is no processor architecture given for the assembly, while it is on my development machine. I tried to uninstall the assembly to then install it again, but couldn't do it due to insufficient rights (even as administrator).

I had to install the Windows SDK a few days ago to use gacutil, could that be the reason for the missing reference?

The programming language is C# 2010 with Visual Studio 2010.

Thanks,

EDIT: I found a solution, although it still doesn't work as it is supposed to be. Here is how it works: The problem can be solved by setting the "specified version" property of the reference to false. New projects can use the interop by referencing to it under C:\Windows\assembly\GAC\Microsoft.Office.Interop.Excel\12.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll

1

1 Answers

0
votes

with a bit more of experimenting, I finally found a solution to the problem and want to share it here. It definitely isn't as it is supposed to be, and I would still really appreciate if somebody knew the reason behind that problem.

The problem can be solved by setting the "specified version" property of the reference to false. New projects can use the interop by referencing to it under C:\Windows\assembly\GAC\Microsoft.Office.Interop.Excel\12.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll