Search code examples
c#.netexceloffice-interopexcel-interop

Microsoft.Office.Interop.Excel Reference in Build Server


I'm using Microsoft.Office.Interop.Excel reference in the windows service application to create excel reports. The application builds fine in DEV machine but in the build machine it fails saying "The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)".

It's working in DEV machine because, MS Excel 2010 is already installed. But in build server, MS Excel is not installed.

My question is whether, installing MS Excel in build server is mandatory for the build to succeed or can i copy the Microsoft.Office.Interop.Excel.dll in my project folders, reference it and check-in for the build. Currently, the dll reference added in the application points to assembly(GAC).

Another thing go to know is that, these interop dll's are not re-distributable as they are part of MS_Office product.

Please suggest me the right approach in this regard.


Solution

  • You need to have MS Excel installed on the build server also. Interop DLL cannot function without Excel itself being present.

    For more details on Office development, you can refer the official documentation on MSDN.