Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: raaurora on August 21, 2015, 05:57:55 am

Title: Difficulty deploying Interop.EA.dll
Post by: raaurora on August 21, 2015, 05:57:55 am
Hello,

I have a Visual Studio 2013/C#/.net 4.5 application which reads through a Sparx repository using the Interop.EA.dll API and formats relevant data into an Excel report.  The API is accessed via a standard project reference.  The project builds to an .exe file with associated dll's for helpers, log4net, etc.

Everything works great when I run the app under visual studio.  However, if I move the application binaries from my laptop to an alternate machine that I can use to schedule the report to run at night, the application fails trying to access the Sparx repository file.  I suspect since the API is a COM object, something is wrong with the way I have deployed it.  I have spent the day hunting blogs and trying different combinations of GACUTIL and REGASM without much luck.

Has anyone successfully deployed an application based on this com object and if so can you provide guidance on things I might try?

The exception I receive follows however it is fairly generic and googling the message and error code does not help unfortunately.

Thanks very much.

[size=10]2015-08-20 07:17:10,443 ERROR [1] ReportGenLog: [highlight]An Exception Was Encountered in Dependency.ReportGen:
System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {67F4E0FA-46A7-4255-B084-69A9433D08C3} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
   [/highlight]at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
   at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType)
   at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   [/size]

Title: Re: Difficulty deploying Interop.EA.dll
Post by: Eve on August 21, 2015, 08:17:35 am
Interop.EA.dll is a wrapper around EA (it only works when EA is installed and licensed). The error that you are seeing is that it can't find EA.
Title: Re: Difficulty deploying Interop.EA.dll
Post by: raaurora on August 21, 2015, 08:46:03 am
Quote
Interop.EA.dll is a wrapper around EA (it only works when EA is installed and licensed). The error that you are seeing is that it can't find EA.

Hi Simon

Thanks very much for the response.  The thing is, Sparx actually is installed on the second machine.  Sorry I did not think to mention that.  I could try re-installing, but as far as I am aware Sparx works fine on that machine we've not had any trouble in that regard.
Title: Re: Difficulty deploying Interop.EA.dll
Post by: Eve on August 21, 2015, 09:37:03 am
Given that it can't find EA, my next guess is that your application is running in the 64bit address space (including being compiled as any CPU) and EA is 32bit only.

You could also try running regsvr32 on EA.exe. (The one in C:\Windows\SysWOW64 is the 32 bit version)
Title: Re: Difficulty deploying Interop.EA.dll
Post by: Geert Bellekens on August 21, 2015, 04:37:48 pm
Hi,

I don't have a ready made answer for you, but I did write an article (http://bellekens.com/2011/02/23/tutorial-deploy-your-enterprise-architect-csharp-add-in-with-an-msi-package/)about deploying an add-ins a while ago.
Maybe some of the things in there can help you further.

Geert
Title: Re: Difficulty deploying Interop.EA.dll
Post by: adama on November 10, 2019, 03:41:10 am
Similar problem.  Running Sparx EA 15.0.1513.  Build on Visual Studio 2019.
MyClass.dll is in the registry and exists as valid Add-in within EA.
Code has  event handler for EA_OnPostNewElement.
Every time the code hits a line with a reference to Interop.EA.dll, I get this error:

"Retrieving the COM class factory for component with CLSID {72BF2E28-5DF4-4BD8-80D0-80C62BD9A026} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))."

Registry does NOT have that CLSID {72BF2E28-5DF4-4BD8-80D0-80C62BD9A026}.
Studio reports the GUID for Interop.EA.dll as {64FB2BF4-9EFA-11D2-8307-C45586000000}
In registry, found bunches of Interfaces with reference to {64FB2BF4-9EFA-11D2-8307-C45586000000}.

Here's the SIMPLIFIED code. Again, exception happens on first reference to EA library.

Function OnPostNewElement (Repository As EA.Repository, Info As EA.EventProperties) As Boolean
        MsgBox("hello")
        fred()
End Function

Private Sub fred()
        MsgBox("hello3")
        Dim e As New EA.Element
 End Sub
=====
I tried re-registering as follows:
C:\Windows\Microsoft.NET\Framework\v4.0.30319> regasm.exe "C:\Program Files (x86)\Sparx Systems\EA\Interop.EA.dll" /verbose
Microsoft .NET Framework Assembly Registration Utility version 4.7.3190.0 for Microsoft .NET Framework version 4.7.3190.0
Types registered successfully
==Then,...
- I tear down, re-build, and re-register my dll.
- I get the same error no matter what I try.  Can't find {72BF2E28-5DF4-4BD8-80D0-80C62BD9A026}

Any ideas out there? Thanks in advance.
Title: Re: Difficulty deploying Interop.EA.dll
Post by: Eve on November 11, 2019, 09:40:42 am
You can't create an EA.Element. (Which is {72BF2E28-5DF4-4BD8-80D0-80C62BD9A026})

You get one from one of the API calls.
Title: Re: Difficulty deploying Interop.EA.dll
Post by: qwerty on November 11, 2019, 10:33:23 am
In other words:
Code: [Select]
element = package.elements.addNew("MyOwnClassName", "Class")
will create a new element in the package's elements collection. (You need to translate that into that VB talk yourself)

q.