A reference to the "....dll" could not be added.Please make sure that the file is accessible and that it is a valid assembly or

When i add a .dll file as a reference in C# application it shows an error :

A reference to the "....dll" could not be added.Please make sure that the file is accessible and that it is a valid assembly or COM component.

Willfin David



Answer this question

A reference to the "....dll" could not be added.Please make sure that the file is accessible and that it is a valid assembly or

  • John Deaver

    It shows the same error:


    TlbImp : error TI0000 : The input file 'E:\dotnet\DeviceDriverAPI\Devi
    ceDriverAPI\ABClib.dll' is not a valid type library.

    What does this represent "is not a valid type library.".Whether the dll contains code other than CSharp.

    Whether the dll have to be changed

    Willfin


  • Dave.cpp

    Try this work around..

    For the <..>.dll with a strong name:
    First: sn -k mykey1.snk
    Second: tlbimp <...>.dll /out: mydll1.dll /keyfile:mykey1.snk



  • csharp2000

    I have compiled as said but it shows the error,


    TlbImp : error TI0000 : The input file 'E:\dotnet\Projects\ABClib128\ABClib.dll' is not a valid type library.

     

    WIllfin


  • onurkocoglu

    Tried the above solution..but no luck !!!
  • FS2

    I think you need to build your own Interop dll

    check this link

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=272955&SiteID=1



  • Mark Tompkins

    I assume you are working with VS2005. So here is the work around for that

    Execute "tlbimp <....>.dll"

    <Drive>:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin>TlbImp.exe <....>.dll

    This command creates <...>CORELib.dll and add it as a reference to the project.

    Hope this works, Let me know the result..



  • Sergey Perepechin

    hi,

    to reference assembly in .net the assembly must have .net metadata format, not like the old assembly, i don't know how to reference the old dll files but once i heard you can do that by p/invoke, as i said i didn't do that b4 so i can't provide more information but you might find this link usefull

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnnetcomp/html/PInvokeLib.asp

    or you can search MSDN for that

    http://lab.msdn.microsoft.com/search/Default.aspx __VIEWSTATE=&query=p%2Finvoke&siteid=0&tab=0

    hope this helps



  • Jayasingh Dharmaseelan

    I cannot build an other dll file because this .dll file is given by the client as a driver for communicating with the USB port. Any suggestions

    Willfin


  • omar 14492

    I have the same problem. Apparently this problem has been known for over a year and there's still no solution. The DLL is fine -- the problem is with the Microsoft *** we're using for development!

    This happens regularly. Just this morning I tried to open an attached bitmap in Microsoft Outlook. It refused, with a cryptic error message. Imagine that: The Microsoft *** wouldn't even open a simple bitmap file! I Googled the error message and found the fix, requiring a change to an obscure Registry entry.

    I'm learning Linux.


  • Arvid

    Use P/Invoke instead. I assume you know the functions you need to call in the dll, so create a static nested called NativeMethods (for consistency) and add the external method signatures to it. Mark each extern method with the DllImport(string) attribute:

    Code Snippet

    private static class NativeMethods

    {

    internal const string DllName = "ABClib.dll"; // handy const


    [DllImport(DllName)]

    internal static extern <returntype> MethodName(parameters...);


    //...

    }


    The dll must either be a registered server or in the same directory as the process image (exe). I suggest you add the dll-file to your project, and set its 'Copy to Output Directory' property to 'Copy always' or 'Copy if newer', that way it's easy to debug your program from VS.

  • Florian Broeder

    It shows the same error:


    TlbImp : error TI0000 : The input file 'E:\dotnet\DeviceDriverAPI\Devi
    ceDriverAPI\ABClib.dll' is not a valid type library.

    Willfin


  • SteveTri

    I have had VS2005, both standard and express edtiions, lock up and stop when I mix C# and VB. By that I mean this. I have a VB project, and want to use a .dl created with C#, and vice-versa. Doesn't happen all the time, but only when I mix the languages through .dll files that contain forms.

    Rudedog



  • D.KamalaKumar

    Hi,

    When i add a .dll file(which has been developed in Visual Basic) as a reference in c# application it shows an error:

    A reference to the "....dll" could not be added.Please make sure that the file is accessible and that it is a valid assembly or COM component.

    Could u give me a solution.

  • BradO

    Have you tried to register the dll first using regsvr32 <dllName> I tried doing that and could use the dll in the .net project.

  • A reference to the "....dll" could not be added.Please make sure that the file is accessible and that it is a valid assembly or