Search code examples
c#visual-studio-2010interopoffice-interopcom-interop

Does Primary Interop Assemblies ( PIA ) require Microsoft Office to be installed in the machine to work


Does Primary Interop Assemblies (PIA) require Microsoft Office to be installed on the machine in order to use?

I have gone through so many confusing post/sites and am unable to arrive at a conclusion.

I have a machine where Office is not installed and I am using VS2010. The Microsoft.Office.Interop.Excel assembly was not available in COM section under reference. I added it through the .Net section in references but it still throws the below error:

Retrieving the COM class factory for component with CLSID failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

Here is the statement from Microsoft's website: The Office PIAs are not required on end-user computers to run Office solutions. What does this mean exactly? Does it mean without Office installation we can work with interop assemblies? If not, why do they require PIA when Office needs to be installed to make it work?


Solution

  • Does Primary Interop Assemblies ( PIA ) require Microsoft Office to be installed in the machine to work ?

    Yes.

    The PIA are simply assemblies that allow you to call the Office COM object model from .NET. The COM objects which are hosted by the Office applications still need to be present for this to work. The Class not registered error you get is because the COM object is missing on the computer. To fix that you need to install the version of Office your application is designed to work with.