Retrieving COM class factory failed error: 80040154

0

Thank you for reading.

I am working on developing a piece of code which executes within and accesses data from a commercial radiation planning software (Eclipse). I'm attempting to have this application.exe also update some model parameters within a SolidWorks model.

Here's the problem: When attempting to open the SolidWorks application (SldWorks swApp = new SldWorks(); ) i get an error: "Retrieving the COM class factory for component with CSLID {xxx-xxx-xxx} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."

I have also attempted the methods described here:

https://www.codestack.net/solidworks-api/getting-started/stand-alone/
After attempting these methods, I receive again the same error.

I understand that this means that the application is attempting to access something in the registry that isn't there, but it isn't clear what I should do to remedy this.

I am running Solidworks 2018 in Windows 7, using Visual Studio Community 2017 as my editor. The piece of code works on its own, and I believe I have all of the relevant Solidworks .dll's referenced properly in my model. Interestingly, if i run the same code as a .dll from within Visual Studio, Solidworks will actually open. This is done using the "SldWorks swApp = new SldWorks();" methodology (which is a part of the Solidworks API methods)

I have no build errors in my solution. I apologize if there is anything confusing in this, as I am new to C# and these APIs. I will do my best to clarify any questions.

I have attempted the methods here: C#: DLL is registered but COM error 80040154 still appear to no avail. Any help is greatly appreciated!
Thank you!

c#
eclipse
solidworks
asked on Stack Overflow Sep 19, 2018 by Michael Kudla • edited Sep 19, 2018 by Michael Kudla

1 Answer

0

Try registering swpublished dll

"C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" "C:\Program Files\SOLIDWORKS Corp\SOLIDWORKS\api\redist\SolidWorks.Interop.swpublished.dll" /codebase

You can also check if 32/64 bit registry has anything to do with your issue. Create a test project that will call new SldWorks() and run it first as 32bit then as 64bit.

answered on Stack Overflow Sep 20, 2018 by Vlad

User contributions licensed under CC BY-SA 3.0