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?
Related
I'm loading a .NET framework DLL from an OEM's website into a .NET 6.0 wrapper DLL.
Then I load that wrapper into my .NET 6.0 Winforms app:
App (.NET6.0) uses
DLL (.NET6.0) uses
DLL (.NET framework)
I get an error:
Could not load file or assembly 'XXX, Version=1.0.9.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified
But if I include a reference to DLL (.NET6.0) in App (.NET6.0), and still load it dynamically, it works.
The difference is the .deps.json - it lists the dependencies of the DLL (.NET6.0).
Building the app without reference to the DLL (.NET6.0) and then replacing the deps.json file, makes it work.
I think it must be something AssemblyLoadContext, but I don't know how to use it to load the dependencies as .NET framework. Or whatever is the difference.
You can see my code here:
https://github.com/pauldeboer1987/MCCDAQ_Wrapper
I'm wrapping the MCCDAQ dll from https://www.mccdaq.com/Software-Downloads
I expect to be wrapping many others, but this is just my example. I think any other .NET framework dll would cause this problem, but I'm not sure.
I added a ResolveEventHandler to currentDomain.AssemblyResolve
as described by Mattias S in
How to add folder to assembly search path at runtime in .NET?
That does the trick. See my updated repo.
I created a test project from .net as a class library, I checked the register for com interop option and it works from visual foxpro.
then I tried to put a reference to a .net dll that I need on this project, it is not strong typed to put it directly on GAC).
I have comvisible class with a method on the test project that calls a method on the .net referenced dll and when I call this method from visualfoxpro I get the error that
"Could not load file or assembly or one of its dependencies ..."
I tested to have the referenced dll on debug folder (that I compile and then test) and from the client app's folder that I'm testing to consume the com dll in foxpro and in none of them the com dll found the referenced dll.
I have another posible folder to put the dll to be found? some code that I need?
When I recompiled the project, it start to work, seems that for some reason the auto publish to COM registry not occurs automatically.
if someone have this problem,
test to use
regasm nameOfLibrary.dll /tlb:nameOfLibrary.tlb /codebase on the .net dll
it loads on the COM registry the dll without put it on the GAC (some warnings about versions, search for that)...
also another option is to make a "registration free activation" that free of the need of registering the COM with regasm to consume the dll later.
I have built a C++/CLI DLL that is a wrapper for some .NET C# DLL. As a sample application I have built a simple project for exe-application based on WindowsForms GUI. It works fine with my C++/CLI library and the mentioned .NET C# DLL. But if I build another C++ DLL, which substitutes this sample exe-application, it doesn't succeed to load the .NET C# DLL, although it is located in the current Windows path. The following exception is occurred when trying to call some function from this C# code:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in MyApp.dll Additional information:
Could not load file or assembly 'xxxx, Version=yyyy, Culture=neutral, PublicKeyToken=null'
or one of its dependencies. The system cannot find the file specified
What are possible problems? In general, how should C# DLLs be linked to unmanaged executables? Is it manifest's problem?
Thanks in advance.
The windows path is not used when loading .NET Assemblies. The assembly must be in the same folder as the executable, or in the GAC. (That is oversimplified a little, see the link below for more detail)
Information about the GAC: http://msdn.microsoft.com/en-us/library/yf1d93sz.aspx
Information about how assemblies are found: http://msdn.microsoft.com/en-us/library/aa720133.aspx
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
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.