Problems registering a dll - dll

I am trying to register a .dll file but I am getting an error. The .dll is in the SysWOW64 folder, through the command line I then cd \Windows\SysWOW64 and run the following command regsvr32 php_sdo.dll
I then get the following error:
"The module "php_sdo.dll" failed to load.
Make sure the binary is stored at the specified path of debug it to check for problems with the binary or dependent.DLL files.
The specified module could not be found"

This kind of failure often occurs when one of the dependency of the DLL one wants to register (which physically means, that the program that attempts to register the DLL internally calls LoadLibrary) is missing. You can have a look at the dependency (tree) of your DLL using Dependency Walker.

Related

The process executed with the extension does not find the path to the referenced dll

The process executed with the extension does not find the path to the referenced dll.
It was normally used when it was executed with ".exe".
However, after running with the extension registered in the registry, trying to use the dll results in an error that the dll file cannot be found.
If you look at the content of the exception that occurred, the dll in the path of "C:\myfolder\myDll.dll" try to find to "c:\Windows\system32\myDll.dll".
How do I do anything other than put it in the System folder to ensure that the extension-enabled process recognizes the path in the dll ?
It is not possible to put it in the system folder, so another method is needed.
p.s ) When i open a process by right-clicking an icon in the taskbar while the process is floating, the newly opened process also generates the same invalid dll path error.
I fixed it.
it cause that "System.Environment.CurrentDirectory" and "AppDomain.CurrentDomain.BaseDirectory" were different.
so when Application start, Check each directory and change it if it is different.
my case in WPF, System.Environment.CurrentDirectory was Windows System folder.

DLL cannot be found when I specify the path and the dll has no missing dependencies

I am writing a program which refers to a dll using the words "Declare"
Whenever I run the program I get an error saying "File not found: x.dll". I tried specifying the whole path, still an error. I tried registering the dll, gives me an error.
I opened the Visual Studio Depends program to see if the dll has missing dependencies and found nothing that could be troubling it.
What could be the cause of this?
Thanks!

CMWImpt.dll was loaded, but the DllRegisterServer entry point was not was not found. This file cannot be registered'

I have a vb6 project, and when i tried to run the source code I got an error which points to the CMWImpt.dll.
I tried to put the dll in the System32, sysWow64, and project folder, and registered it. But this is the error:
CMWImpt.dll was loaded, but the DllRegisterServer entry point was not was not found. This file cannot be registered'
anyone who encountered this before?
thanks
What's the error message?
Not all dlls are registerable. Only COM dlls have registration. And they are usually but not always in the dll (sometimes in another dll).
Error messages that mention dll names are not COM errors mostly. COM errors are of the type "Cannot create activex object", unless correctly registered and the file deleted.
So your file is either corrupted or not a COM dll.
The WinAPI uses dynamic linking. DLL stands for Dynamic Link Library, COM dlls have 4 or so standard dynamic functions to controll COM like DLLRegisterServer.
So you need to provide more detailed info on the problem.

NUnit unable to load dll with String Key Name

I have a project in which I have some C# classes which I am building using csc in my ant script. I have also have written some unit tests which I want to test with NUnit2.6, My test class and actual class refer to one DLL which is compiled with String Key Name (.snk), if I install thi DLL in my GAC (gacutil /i myDLL.dll) everything works fine. As soon as I uninstall this DLL from my gac I get following error for all the test during the build when I try to run my test using NUnit;
Test Error : fromJDynTest1
[exec] System.IO.FileNotFoundException : Could not load file or assembly 'myDLL, Version=5.1.0.0, Culture=neutral, PublicKeyToken=c0409b584f86b2d6' or one of its dependencies. The system cannot find the file specified.
[exec] at fromJDynTest1()
...
...
Does anyone know how to resolve this. Let me know if you need any other information.
Thanks
--
SJunejo
The code you are testing cannot see the assembly in question when you place it in the gac it can see the assembly. You need to ensure that the code you are testing has the assembly in the bin directory when compiled (perhaps copy local is set to false in your project on the assembly reference).
The reason I am sure it is not a dependency (which is mentioned in the message) is because the situation is resolved when the assembly is placed in the gac. This error is not likely caused because the assembly is strongly named.
Failing that the test code refers to the assembly and that test code either doesn't have a reference or has the same problem (not in its compiled directory).
Would help if you posted the actual test or structure of the project.
.net locates assemblies as follows:
Determines the correct assembly version by examining applicable configuration files, including the application configuration file, publisher policy file, and machine configuration file. If the configuration file is located on a remote machine, the runtime must locate and download the application configuration file first.
Checks whether the assembly name has been bound to before and, if so, uses the previously loaded assembly. If it failed before it will fail again now.
Checks the gac. If the assembly is found there, the runtime uses this assembly.
Probes for the assembly (if you open up a .csproj file in a text editor you will see hintpaths, which try and help .net find the assembly).

Missing MySQL DLL?

I've recreated the Northwind Spring/NHibernate example that comes with Spring.NET, but with MySQL rather than SQLServer. I've almost got it working I think, but I'm getting this when I try to use Hibernate to load something from the database
A first chance exception of type 'System.IO.FileNotFoundException'
occurred in mscorlib.dll NHibernate.Util.ReflectHelper:
ERROR lambda_method - Could not load type
MySql.Data.MySqlClient.MySqlCommand, MySql.Data.
System.IO.FileNotFoundException: Could not load file or assembly
'MySql.Data' or one of its dependencies.
The system cannot find the file specified.
File name: 'MySql.Data'
Every project (DAO, Service, Web) has a reference to the MySQL.Data DLL so I'm a bit unsure what's going on.
Can anyone help me please?
Make sure that MySQL.Data.dll actually got copied to the output folder. And that you are using right platform (x32 vs x64 bit) and right version of .NET (2,3,3.5 vs 4). If everyhing seems fine, enable Fusion Logging and take a look at this article:
For FileNotFoundException: At the bottom of the log will be the paths
that Fusion tried probing for this assembly. If this was a load by
path (as in Assembly.LoadFrom()), there will be just one path, and
your assembly will need to be there to be found. Otherwise, your
assembly will need to be on one of the probing paths listed or in the
GAC if it's to be found.
You may also get this exception if an unmanaged dependency or internal
module of the assembly failed to load. Try running depends.exe on the
file to verify that unmanaged dependencies can be loaded. Note that if
you re using ASP.NET, the PATH environment variable it's using may
differ from the one the command line uses. If all of them could be
loaded, try ildasm.exe on the file, double-click on "MANIFEST" and
look for ".file" entries. Each of those files will need to be in the
same directory as the manifest-containing file.