I have a asp.net application calling intermediate C# dll which will make a call to a legacy vb6 dll through COM. During the actual call I find an error in my logs from my vb6 dll:
"Could not load file or assembly, 'Generic_C#_DLL.DataAccess, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0c9890f55677d2' or one of its dependencies. The system cannot find the file specified"
Why is my vb6 COM dll trying to load some of my other C# dlls? Is it because the dll that is calling the vb6 COM dll also referencing the 'Generic_C#_DLL.DataAccess'?
I think I am referencing the vb6 dll correctly in the C# dll that is calling COM by having a reference to 'Interops.VB6dll' and I have properly registered the vb6 dll with regasm.exe...So as of now I am kind of clueless to why this is happening, does anyone have any advice?
We're going to need to see code to be able to best help with this. However, note that this also says "or one of its dependencies", which may indicate that there is another load failure preventing this one.
There are a few very useful tools for figuring out DLL loading problems:
Fuslogvw.exe (Assembly Binding Log Viewer)
Dependency Walker 2.2
Process Monitor v3.03
Related
I have a ASP project, which calls a C++ dll file, we called it A temporary. Then A calls a COM dll using C# coding, there is a function to use API "LoadTypeLib" to load the type library of the COM DLL, using relative path, the com dll is in same level directory of A file, but it failed with error code TYPE_E_CANTLOADLIBRARY?
Make sure the COM dll is registered. If it's not the runtime will not be able to find it to make call to loadlibrary
I'm want to find the answers for this problem:
I'm developing a .NET 4.0 DLL wich has reference to another third party Dll FTP. This DLL that i'm developing is loaded through reflection by another DLL called LoaderDLLs.
LoaderDLLs is exposed for COM, the problem is when the COM use DLL to invoke .NET DLL 4.0 everything is fine but when .NET DLL 4.0 internally call third party DLL FTP occurs next error:
Exception has been thrown by the target of an invocation.Could not load file or assembly 'Jscape.Ssh, Version=2.7.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
I have attemped install third party DLL FTP into GAC through gacutil, but a think this is not working, How can i get reference to that DLL?
I recently wrote a small native c++ wrapper in C++/CLI. Its a simple program. I am able to compile it properly and able to add the dll refeernce in my C# project without any errors. I can also create the object from this CPP/CLI dll and access the functions at compile time without any errors.
Now When I run the program, The first function call which references the object from this dll throws an exception. The exception is as follows:
Could not load file or assembly 'ProtobufWrapper, Version=1.0.4381.26401, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
I am not sure what is wrong in my case.
Is the DLL file located in the same directory as the .Exe you're starting? Sometimes the file won't get copied and can't be found.
On the DLL reference click properties and check for build action. Set it to Copy.
I'm getting a System.DllNotFoundException for a .dll which is in the same folder as the executable whenever my application attempts to use a function which exists in the DLL. The weird thing is that it is only occurring on one user's PC; it works fine on my dev PC and it works fine on one non-dev PC that I tried it on. Also, there are other DLLs in the folder which are being found and used correctly. The DLL in question is a native library which is referenced by my application via another DLL which is a c# wrapper for the native library.
My initial instinct is that there must be some other library being referenced by this DLL which doesn't exist on the problematic PC, but I cannot imagine what library this PC could be missing that the other non-dev PC has.
So my questions are this: is there a way to determine the dependencies of a given DLL file? Keep in mind that the DLL in question is a native library (i.e. not managed code), and I do not have access to it's source code. And if it turns out no dependency is missing, what else might cause such an issue?
For unmanaged dlls you can use Dependency Walker to find dependencies.
I would suggest using ILSpy to open the dll and view its dependencies first.
I've created a dll using managed C++. Now I'm trying to use it from C#. I've added the Object to project references. Object browser shows the object in the dll correcly, path to the dll in object browser corresponds to the actual path.
However, when I run the C# program it complains:
Unhandled Exception: System.IO.FileNotFoundException: The specified module could
not be found. (Exception from HRESULT: 0x8007007E)
Any idea what else have to be done?
Thanks.
I think that you're missing the other assemblies or dll's references by your managed C++ assembly.
Does your managed C++ assembly have an other dependencies, including unmanaged dlls? You'll see this error at runtime if your referenced assembly fails to load a dependency.
Are you running the application in release on a machine without VS installed?
I only ask because I ran into a similar problem here: Mixed Mode Library and CRT Dependencies - HELP
if you scroll down to my answer you can see what I did that helped me.
Check that the c++ assembly is present in the same folder as your c# program. It should be copied over automatically if the 'Copy Local' property is set to true (on the reference to the c++ dll in your c# app).
If the c++ dll is there, the most likely problem is that the c++ dll depends on another non-managed dll which cannot be found (i.e. c# will not copy these to your app folder because it does not know about unmanaged references). You can use DependencyWalker on the c++ dll to check for missing dependencies.
Another probable couse could be a problem with your MSVC runtime dlls. see if DependencyWalker complains about missing MSVCR*.dll, MSVCP*.dll etc... files.