Recently I have faced an issue when using the references.
Explanation:
My DLL does the operation of adding AD users to SharePoint user group.
Its working fine when I try in Visual studio 2010.
But after adding as a reference in AX2012 I’m receiving the following error, when I try accessing that dll thru job.
Error:
“Error in System.Exception Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).”
Solution tried:
Changing the platform target to x64 bit in Visual studio 2010.
Notes: After building the project in x64 bit, I was getting “Variable **** has not been declared” error.
One more attempt - if AOS is on a different machine than Visual Studio, your test in VS doesn’t prove that it works. Maybe the COM object isn’t really registered on the machine with AOS.
Also, the AOS service may not have permissions to use the COM object (see Security in COM).
obj = new MyDLL.Class1();
//strReturn = obj.CreateADUser(“User”,“Domain”,“AdminName”,“AdminPassword”); // Creating AD user
strReturn = obj.AddUserInEP(“User”,“UserGroup”); //Adding user to SP2010