Author Topic: could not be found in interop assembly  (Read 142 times)

0 Members and 1 Guest are viewing this topic.

_jon_

  • Mosquito
  • Posts: 2
could not be found in interop assembly
« on: December 01, 2017, 05:09:44 pm »

Apologies if this has been asked before - I have seen references to this error in other posts but have not found a solution.  I have some code that builds and runs in 2016 (VS2012), and I am having trouble porting it to 2018 (VS2015).  I updated all of the references to the 2018 version of the DLLs, but I get a bunch of errors saying that references to several classes "claims it is defined in 'Autodesk.AutoCAD.Interop', but it could not be found".  I triple checked that I have the correct DLLs and I updated my project to framework 4.6 but I can't seem to get rid of these errors.  Any suggestions?  I'm really stumped. 

Jon

FriendFromArea51

  • Swamp Rat
  • Posts: 712
  • Mars sucks!
Re: could not be found in interop assembly
« Reply #1 on: December 04, 2017, 11:04:36 pm »
Is this on your own PC, or others? I've seen stuff like this when sending DLLs to others, and they have to unblock it.

_jon_

  • Mosquito
  • Posts: 2
Re: could not be found in interop assembly
« Reply #2 on: December 05, 2017, 10:29:42 am »
Thanks for the reply.  The DLLs came from my own PC.  I double checked and none of the DLLs are blocked.  After investigating further, it looks like the errors are related to my use of the Civil 3D interop assemblies, even though it is the AutoCAD interop assemblies that are displayed in the error message.  I created a blank C# project, referenced in the two AutoCAD interop assemblies, and the Base, UIBase, Land, and UiLand interop assemblies from Civil 3D.  I created a single class with the code below.  the error is on the d.Regen statement.  If I change the type of "d" to AutoCAD.Interop.Common.AcadDocument the code builds just fine. 

Code: [Select]
    class Class1
    {
        public Class1(Autodesk.AECC.Interop.UiLand.AeccDocument d)
        {
            d.Regen(AcRegenType.acActiveViewport);
        }
    }

n.yuan

  • Bull Frog
  • Posts: 240
Re: could not be found in interop assembly
« Reply #3 on: December 05, 2017, 01:37:15 pm »
Do you have Autodesk.AutoCAD.Interop/Autodesk.AutoCAD.Interop.Common.dll referenced in the project? If not, you should have, because all the Civil3D COM interop DLLs are dependent to the vanilla AutoCAD COM interop Dlls.

Or, maybe this:

Because VisualStudio (since 2012?) automatically embeds COM interop types in the project, so, it is possible when you upgraded your project from Civil2016 to Civil2018, VS did not create a new project file (and its resources), thus the project somehow inherited the embedded Autodesk.AutoCAD.Interop/Common dlls? If it is this case, the later version of Civil COM interop DLLs may not be compatible to early version of AutoCAD interops.

So, you may want to try to remove ALL COM interop DLLs (Civil3D's and AutoCAD's) and re-add them back with sure that the COM interops all being from Civil3D2018.