System.DllNotFound Exception

I'm migrating from VB 6.0 to VB.NET 2003. There is a particular file abc.dll that I'm not able to add reference to, though its a dll file.

When I try to reference it, the error is

'This is a not a valid assembly or COM component. Only assemblies with extension 'dll' and COM components can be referenced. Please make sure the file is accesible, and that it is a valid assembly or COM component'

How can I reference this file



Answer this question

System.DllNotFound Exception

  • leemcd

    I think you may be referring to declare function statements.

    Also I'm not sure if the VB6 project you are converting is residing on this machine and working, if youve copied it from another machine then you may not have the COM component installed and registered on the 2005 machine.

    This may be a custom control used in the project. So do ensure that everything required for the VB6 application is working and installed correctly.


  • Dean Perry

    So I would remove them from each folder to see which one the application is using - You dont want to still be in the dark as to where its looking for the files when you come to deploy.


  • Igor L

    If this is not being seen as a COM component you likely need to do a P/Invoke against it.

    In your old VB6 project, did you have a few ‘define function’ statements that referenced this DLL If so, this is exactly the sort of thing you will need here. Take a look at pinvoke.net for some examples.



  • Nevan

    Is the file ABC.DLL in a directory that your running app on your machine can access (like sitting right next to it in the same dir)



  • Roberto Brunetti

    Hello,

    I'm having truoble again with another dll. This time its Winsock.dll.

    After migration my application that uses this dll, it gives me the following error when WSAstartup() is executed.

    "The application or DLL C:\windows\system32\winsock.dll is not a valid windows image. Please check against your installation diskette."

    My OS is win xp pro 2002

    working on VS 2003 and migrating an appln form vb6 to vb.net

    winsock.dll version is 3 and its 16-bit

    I also added ws2_32.dll and wsock32.dll to my project directory as these are 32-bit, but the error persists.

    Any suggestions


  • nater1111

    Where on you local machine is this currently residing in relation to this VB Project. Is it in the same directory as the executable. If not then add it as a reference in the project to ensure it gets included with your executable and copied to the bin folder.

    Also as a point integer in VB6 is a short in VB.Net


  • Lord Finn

    So it is where it needs to be and still not being found... What about an unsatisfied dependency

    Is there any chance of this DLL relying on other DLL’s or components that you do not have on your system and did not know to copy over from the server

    To check this... load the DLL in question in depends.exe (available here if you do not already have it) and see if there are any errors related to files not being found.



  • casimir

    after copying .dll file to all possible directories, I rebooted my system.

    Now the .dll methods are accessible without error.

    Thank you for your help!


  • PFI

    This .DLL is a custom component and is actually sitting in the server. And I have copied it on to my machine.

    Yes the .dll file is in the \bin folder of my project


  • wacher

    I'm only trying to access the methods available in this custom dll. I do have function declarations in my project like this:

    Declare Function ABCIWriteData Lib "ABC.DLL" Alias "A_WriteData" (ByVal Name As String, ByVal Buffer As String) As Integer

    In VB 6.0 (resides on server), its worknig fine from my machine, but for VB.NET(resides on my machine), the same functions throws the above error. What do I do now


  • Emil Christopher Melar

    I check it thru dependency walker and it shows one warning

    Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

    Other than this nothing else is there


  • cmckeegan

    The dll is located in both windows\system32 and in the directory of my project. But VB.NET does not allow me to add a reference of this dll to my project. It throws the error that it is not a dll or com component
  • ar3

    Well its interesting that its not recognizing the dll as a a com component.

    Where did this dll come from

    When you say in the directory of my project are you actually meaning the

    bin\debug and/or bin\release sub folders of your project


  • Xenocrates

    So no errors at all... very strange... if the DLL is where you say it is, your application should be able to find it unless there are issues with loading it and its dependencies... which you are saying there are none of.

    Grrr



  • System.DllNotFound Exception