title: Retrieving the COM class factory for component with CLSID {guid} failed due to the following error: XXXX Class not registered + Office 365
body: <p>I am building SharePoint auto-hosted app. In that I have used Microsoft.Office.Interop.Word dll. I have published app to the Office-365 environment. When my code reaches to the line where I am initializing the interop object it throws this error.</p>
  
  <p>Line:  </p>
  
  <pre><code>Microsoft.Office.Interop.Word.Application ap = new Microsoft.Office.Interop.Word.Application();
  </code></pre>
  
  <p>And Error I got :  </p>
  
  <pre><code>Error in Default page: System.Runtime.InteropServices.COMException(0x80040154): Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
    at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean&amp; canBeCached, RuntimeMethodHandleInternal&amp; ctor, Boolean&amp; bNeedSecurityCheck)
    at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark)
    at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark&amp; stackMark)
    at System.Activator.CreateInstance(Type type, Boolean nonPublic)
    at System.Activator.CreateInstance(Type type)
    at DocumentAppTestWeb.Pages.Default.Page_Load(Object sender, EventArgs e)
  </code></pre>
  
  <p>When I run my app by pressing <code>F5</code> it runs perfectly.<br>
  But when I publish my <code>.app</code> file to the app catalog of my Office 365 environment it gives me above error.  </p>
  
  <p>Is there any option that I can use?
  Any help will be appreciated..!</p>