Cannot use interop DLL generated with TlbImp.exe

Cannot use interop DLL generated with TlbImp.exe

Bradleywalker12380
Advocate Advocate
1,872 Views
16 Replies
Message 1 of 17

Cannot use interop DLL generated with TlbImp.exe

Bradleywalker12380
Advocate
Advocate

Hi,

 

I used TlbImp.exe to generate AcETransmit20.Interop.dll from AcETransmit20.tlb using:

"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\TlbImp.exe" "C:\Autodesk_ObjectARX_2019_Win_64_and_32_Bit\inc-x64\AcETransmit20.tlb" /out:AcETransmit20.Interop.dll /namespace:AcETransmit /machine:x64 /verbose

 

I added AcETransmit20.Interop.dll to my (.Net 4.8) solution. When I run my project I get this error:

System.Runtime.InteropServices.COMException: 'Retrieving the COM class factory for component with CLSID {A994CA23-17EB-4C43-8345-EDEE893F2186} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).'

 

So I try to register using Regsvr32, but I get the error

The module ".....\AcETransmit20.Interop.dll" was loaded but the entry-point DllRegisterServer was not found.

Make sure that ".....\AcETransmit20.Interop.dll" is a valid DLL or OCX file and then try again.

 

Any suggestions? I also tried RegAsm but that didnt help either.

 

 

0 Likes
Accepted solutions (3)
1,873 Views
16 Replies
Replies (16)
Message 2 of 17

Alexander.Rivilis
Mentor
Mentor

It is look like AutoCAD 2019 is not proper installed.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 3 of 17

Bradleywalker12380
Advocate
Advocate

Hi,

 

I did a re-install and it did not work.

 

-Brad

0 Likes
Message 4 of 17

Alexander.Rivilis
Mentor
Mentor

What kind of project you try to create? Standalone exe file or .NET dll plugin?

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 5 of 17

Bradleywalker12380
Advocate
Advocate

I am creating a standalone console exe.


Is there some something I am missing to generate an interop dll?

I am following this info from the ADN blog: https://adndevblog.typepad.com/autocad/2012/05/resolving-references-when-using-tlbimp-.html

 

 

0 Likes
Message 6 of 17

Alexander.Rivilis
Mentor
Mentor

As far as I know it is impossible to use ETransmit in standalone exe-file. ETransmit use AcETransmit.dll, which is the arx-file loaded into acad.exe and and can not been used in other standalone application.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 7 of 17

Bradleywalker12380
Advocate
Advocate

So that is the correct method to create an interop dll? Id like to rule that out please.

 

Edit: It can be used outside of AutoCAD because according to the ADN blog, RealDWG uses it which is a subset of ObjectARX. So the AutoCAD SDK should be able to support that.

0 Likes
Message 8 of 17

Alexander.Rivilis
Mentor
Mentor

@Bradleywalker12380 wrote:
So that is the correct method to create an interop dll? Id like to rule that out please.

Method of creating interop dll is correct. In my case I need to delete /verbose key from command line - with this key I have such error:

E:\ObjectARX2019\inc-x64>TlbImp.exe AcETransmit20.tlb /out:AcETransmit20.Interop.dll /namespace:AcETransmit /machine:x64 /verbose
Microsoft (R) .NET Framework Type Library to Assembly Converter 4.8.3928.0
Copyright (C) Microsoft Corporation.  All rights reserved.

TlbImp : Resolved referenced file 'AcETransmit20.tlb' to file 'E:\ObjectARX2019\inc-x64\AcETransmit20.tlb'.
TlbImp : error TI1000 : The type library importer encountered an unexpected exception: System.DllNotFoundException - Не удается загрузить DLL "tlbref.dll": Не найден указанный модуль. (Исключение из HRESULT: 0x8007007E)

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 9 of 17

Bradleywalker12380
Advocate
Advocate

I got past that error by copying that dll from "C:\Windows\Microsoft.NET\Framework\v4.0.30319\TLBREF.DLL" to the same folder as tblimp.exe

0 Likes
Message 10 of 17

Alexander.Rivilis
Mentor
Mentor
Accepted solution

You can try to set your application as x64 - in other case you can not use this interop dll.

But I think you wrong about ability to use ETransmit API in standalone application.

We can ask @moogalm about possibility using ETransmit API from standalone exe (except RealDwg exe)  

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 11 of 17

Bradleywalker12380
Advocate
Advocate

I tried that, and got "Class not registered " again.
According to the blog post https://adndevblog.typepad.com/autocad/2012/05/resolving-references-when-using-tlbimp-.html it says you can specifically use ETRansmit in a stand alone project, thats why it in the same post it offers the tlbimp conversion.

 

They even provide the code in this other post https://adndevblog.typepad.com/autocad/2014/10/including-fonts-and-other-files-using-etransmit-api-.... 

 

Can you try that code and see if it works in a standalone exe, please?

 

I have working .Net code here:

 Public Sub DependentFilesMethod()
        Dim tf As TransmittalFile = Nothing
        Dim [to] As New TransmittalOperation()
        Dim ti As TransmittalInfo = [to].getTransmittalInfoInterface()
        ti.includeDataLinkFile = 1
        ti.includeDGNUnderlay = 1
        ti.includeDWFUnderlay = 1
        ti.includeFontFile = 1
        ti.includeImageFile = 1
        ti.includeInventorProjectFile = 1
        ti.includeInventorReferences = 1
        ti.includeMaterialTextureFile = 1
        ti.includeNestedOverlayXrefDwg = 1
        ti.includePDFUnderlay = 1
        ti.includePhotometricWebFile = 1
        ti.includePlotFile = 1
        ti.includeUnloadedXrefDwg = 1
        ti.includeXrefDwg = 1

        Dim dwgFile As String = "C:\Users\LAB_USER\Desktop\_etransmit test\2013181.dwg"
        If [to].addDrawingFile(dwgFile, tf) = AddFileReturnVal.eFileAdded Then

            Dim tfg As TransmittalFilesGraph = [to].graphInterfacePtr()

            Dim rootTF As TransmittalFile = tfg.getRoot()

            DisplayDependent(rootTF)
        End If
    End Sub

    Sub DisplayDependent(ByVal tf As TransmittalFile)
        Dim numberOfDependents As Integer = tf.numberOfDependents
        For i As Integer = 0 To numberOfDependents - 1
            Dim childTF As TransmittalFile = tf.getDependent(i)

            Dim ft As FileType = childTF.FileType

            Dim sourcePath As String = childTF.sourcePath

            'Console.WriteLine.DocumentManager.MdiActiveDocument.Editor.WriteMessage(String.Format("{0} Dependent {1} - {2}", Environment.NewLine, ft.ToString(), sourcePath))
            Console.WriteLine(String.Format("{0} Dependent {1} - {2}", Environment.NewLine, ft.ToString(), sourcePath))

            DisplayDependent(childTF)
        Next i
    End Sub

 

0 Likes
Message 12 of 17

Alexander.Rivilis
Mentor
Mentor

This code only for using in .NET plugin and not for using in standalone application.

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 13 of 17

Bradleywalker12380
Advocate
Advocate

I see... well just to completely put this to rest, I hope @madhukar.moogala can confirm this, or provide insight as to why the DLL isnt working. I appreciate the help very much though.

0 Likes
Message 14 of 17

artc2
Autodesk
Autodesk
Accepted solution
AcETransmit.dll has a dependency on AcDb24.dll and other related dlls which cannot be used in anything other than an AutoCAD based product or a licensed RealDWG host application.
Message 15 of 17

Alexander.Rivilis
Mentor
Mentor

@artc2 

Thanks for clarifying!

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes
Message 16 of 17

moogalm
Autodesk Support
Autodesk Support
Accepted solution

Transmittal COM library needs to be in AutoCAD domain [If not realdwg app], so you need create AutoCAD .NET command wrapping with transmittal logic and call this command from out of process.

Message 17 of 17

Bradleywalker12380
Advocate
Advocate
Thank you @moogalm for that clarification. For some of us that are not experts would not have found that out.
The blog posts I saw you wrote didnt say if it was for ObjectARX or RealDWG... it would be interesting to read something covering it for both ways.

Anyways, I still appreciate the help everyone. Thanks!

0 Likes