Search code examples
.netdllms-officeoffice-interop

Does Interop perform without MS Office installed on web server.?


While working on the Interop COM for converting the MS Document to .PDF in dot net, it is realized/observed that interop cannot work if MS Office is not installed on web server. Just for the understanding, Is it there possibility to add / to reference the dependencies of interop COM objects (required ms office dll) to the project. Then can interop will work or not.


Solution

  • Interops files are used for marshalling your property or method calls to the unmanaged applications (a COM server). They can't be used without the end point represented in your case by the Office application.

    Moreover, Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

    If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

    If you deal only with Open XML documents consider using the Open XML SDK, see Welcome to the Open XML SDK 2.5 for Office for more information. Also you may find third-party components designed for the server-side execution.