Author Topic: Problem building Add-In  (Read 6021 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Problem building Add-In
« on: October 30, 2018, 03:01:09 pm »
Our (C#) Diagrammer Add-in uses EA.tlb and Interop.EA.dll.  We don't always update these files with the latest releases, so as not to be on the "Bleeding Edge".

We have been running successfully with the build 1308 version since Nov 2016.  But we decided to update to the v14 build 1427 versions.  Imagine our surprise when the following message popped out of VS:
Error   CS0246   The type or namespace name 'EA' could not be found (are you missing a using directive or an assembly reference?)

Since all we've done is to replace the 1308 files with the 1427 files, we didn't expect this.  Is anybody else experiencing a similar problem?

Has anything changed in the files to cause this?    Did we miss something n the way through?

Reported,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Problem building Add-In
« Reply #1 on: October 30, 2018, 03:34:49 pm »
I think I've seen such a message from time to time.
Clean and rebuild should normally work. I think I sometimes even needed to restart VS before the error went away.

Also check the way the EA.Interop.dll is referenced.

I have
- Aliases=Global
- Copy Local = True
- Embed Interop Types = False
- Specific Version = False

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Problem building Add-In
« Reply #2 on: October 30, 2018, 05:35:35 pm »
Thanks, Geert,
I think I've seen such a message from time to time.
Clean and rebuild should normally work. I think I sometimes even needed to restart VS before the error went away.
None of these help.
Quote
Also, check the way the EA.Interop.dll is referenced.

I have
- Aliases=Global
- Copy Local = True
- Embed Interop Types = False
- Specific Version = False

Geert
I'm running VS2017 Professional and there isn't an Embed Interop Types property.
The other values are the same.

It's almost as if the file isn't there.  I get the same message if I rename the file in its location to another name.

Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Problem building Add-In
« Reply #3 on: October 30, 2018, 06:14:37 pm »
Weird, I'm using VS2017 as well, but I do see the option to Embed Interop types.

Have you tried removing the reference and then adding it again?

On my machine it references the Interop dll located in the Program Files directory for EA.
So each time I change the "active" version of my EA it points to a different file. I never had issues with that (except when I try to use an older version that doesn't support some of the used operations)

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Problem building Add-In
« Reply #4 on: October 31, 2018, 02:10:33 pm »
Weird, I'm using VS2017 as well, but I do see the option to Embed Interop types.

Have you tried removing the reference and then adding it again?

On my machine, it references the Interop dll located in the Program Files directory for EA.
So each time I change the "active" version of my EA it points to a different file. I never had issues with that (except when I try to use an older version that doesn't support some of the used operations)

Geert
How will that help? (not criticising, just trying to get understanding  :) )  The reference references the correct file already.  That can be proved.

I DID check that all occurrences of the reference referenced the SAME file - and they do.

And, 'till now, I too have never had any problems.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Problem building Add-In
« Reply #5 on: October 31, 2018, 02:35:02 pm »
I've had a reply from Sparx indicating a course of action (involving reinstalling EA).  I'll try that out and report.

Paolo

[Edit: NO change in behaviour.  I even changed every reference to point to the EA instance in Program Files (x86).  Still NO change.

So, I copied the build 1308 files EA.tlb (probably not necessary, but still...) and Interop.EA.dll to the EA directory and the build worked!

WTF?]
« Last Edit: October 31, 2018, 03:18:53 pm by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Problem building Add-In
« Reply #6 on: October 31, 2018, 05:23:31 pm »
Paolo,

I don't know how the internals in VS work, but I've witnessed cases in the past where removing and add-in the reference to the interop dll made it work again.

I would focus on why you are not seeing "embed interop files" in the reference properties. That sound fishy to me.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Problem building Add-In
« Reply #7 on: November 01, 2018, 10:54:31 am »
Paolo,

I don't know how the internals in VS work, but I've witnessed cases in the past where removing and add-in the reference to the interop dll made it work again.

I would focus on why you are not seeing "embed interop files" in the reference properties. That sound fishy to me.

Geert
Agreed, it is fishy not to have that property, but that doesn't solve the basic question of what's the difference between the two files?  One works, one doesn't - regardless of where the reference is.  I'm going to download 1427 again and re-install and see if that changes anything.  I've already re-installed from my current download - to no avail.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Problem building Add-In
« Reply #8 on: November 01, 2018, 11:04:29 am »
Agreed, it is fishy not to have that property, but that doesn't solve the basic question of what's the difference between the two files?  One works, one doesn't - regardless of where the reference is.  I'm going to download 1427 again and re-install and see if that changes anything.  I've already re-installed from my current download - to no avail.

Is it a problem with the DLL registration?

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Problem building Add-In
« Reply #9 on: November 01, 2018, 11:18:24 am »
Agreed, it is fishy not to have that property, but that doesn't solve the basic question of what's the difference between the two files?  One works, one doesn't - regardless of where the reference is.  I'm going to download 1427 again and re-install and see if that changes anything.  I've already re-installed from my current download - to no avail.

Is it a problem with the DLL registration?
That's what Sparx have suggested.  However, the registration occurs during installation and (presumably) points to the dll in the EA folder.  So why does one file work and the other not?  (<caveat>By NO means a dll expert</caveat>)

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Problem building Add-In
« Reply #10 on: November 01, 2018, 12:10:56 pm »
That's what Sparx have suggested.  However, the registration occurs during installation and (presumably) points to the dll in the EA folder.  So why does one file work and the other not?  (<caveat>By NO means a dll expert</caveat>)

I'm not sure why you'd do a full reinstall then.  The logical thing to do is to re-register that one dll (https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/regsvr32) and see if anything changes.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Problem building Add-In
« Reply #11 on: November 01, 2018, 12:26:04 pm »
Curiouser and curiouser!  Here's the entry for interop from the applicable .csproj file:

<Reference Include="Interop.EA">
<HintPath>..\..\..\..\COTS\SparxEA\Interop.EA.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>

You can clearly see the Embed Interop Types section is present!

So why doesn't it appear in the properties list?

Paolo


Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Problem building Add-In
« Reply #12 on: November 01, 2018, 12:31:18 pm »
That's what Sparx have suggested.  However, the registration occurs during installation and (presumably) points to the dll in the EA folder.  So why does one file work and the other not?  (<caveat>By NO means a dll expert</caveat>)

I'm not sure why you'd do a full reinstall then.  The logical thing to do is to re-register that one dll (https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/regsvr32) and see if anything changes.
The regsvr32 requires the /i:<sdomething> option since DLLRegisterServer entry point is not found.  Whatever EA does on install to register the server, I'm not privy to.  So I'm going to uninstall EA and re-install and see what happens.

Also, for the record, it happens on multiple machines both under VS2017 and VS2010!

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Problem building Add-In
« Reply #13 on: November 01, 2018, 04:00:25 pm »
So, I've been "around the houses" on this.

I found some of the .csproj file reference entries were slightly different (for the dependent subprojects).  They are NOW identical, and all use a direct (as opposed to relative) reference to the Interop.EA.dll.  But again, no difference in behaviour.  The 1308 file works, the 1427 file doesn't.

As an interesting sideline, I found an old v10 Interop.EA.dll.  If I use that instead, I get errors due to the fact that I'm referencing non-existent API calls, but NOT that the entire namespace is missing!

I've spent enough on this, for the present.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!