0

I am still new to the C# dll world, I been creating my class library for couple of days by now, it's humble nothing sophisticated, yet, after building the solution and getting the output dll file and trying to register it to a printer plugin program it shows an error message of

"Error file was not found or the file contains no TYPELIB section"

I searched about the error "TYPELIB section in dll files" some of the results suggested using the csc.exe or Developer Command Prompt for VS2012, I tried compiling it from there but it gave me errors of missing namespaces that have been used within the dll file, the output dll file uses another dll files, it's impossible to remove the other namespaces.

So what am I missing? How do I define the dll file as TYPELIB?

EDIT

the registry tool that i m using takes the dll/exe file that contains the functions and embed it to the printer software, the printer has two USB Ports, one for the printer and printing jobs and the other one is for the Mifare/SmartCard that will write the info on the card.

Ameer Adel
  • 82
  • 1
  • 1
  • 12
  • c# dlls are different by nature and can't be used as a TYPELIB. If you want it globally registered, that goes in the GAC. – Daniel A. White Mar 03 '15 at 13:28
  • if you are trying to use COM, have a look here: https://msdn.microsoft.com/en-us/library/zsfww439%28v=vs.110%29.aspx – Daniel A. White Mar 03 '15 at 13:30
  • Read [this](http://stackoverflow.com/q/3814467/1997232), perhaps *trying to register it to a printer plugin program* not going to happens as you cannot call managed code (c# dll) from native (printer plugin program) [directly](http://stackoverflow.com/q/225277/1997232). – Sinatr Mar 03 '15 at 13:34
  • @Sinatr a non .NET-process can call methods on a .NET DLL through COM. – CodeCaster Mar 03 '15 at 13:37
  • thanks guys, i figured that we will most likely create a COM file that will expose the dll methods to the printer. – Ameer Adel Mar 03 '15 at 14:04
  • 3
    Embedding the type library as an unmanaged resource in the executable file is a very common practice. But it is very incompatible with the .NET build model, it requires a linker. It is never necessary, tools that use type libraries always also support specifying the .tlb file directly. You just have to create it, use Tlbexp.exe. – Hans Passant Mar 03 '15 at 15:13

0 Answers0