http://forum.codecall.net/c-programming/14278-changing-name-dll.html
.NET DLLs (called assemblies) are not the same as normal DLLs.
The file name is not the real name of the assembly, this is encoded in the assembly manifest inside the file. If you run the tool ildasm.exe (which is part of the Windows SDK) you will find an entry in teh assembly manifest that looks something like this:
.assembly MyAssemblyName
{
hashAlgorithm=...
}
this is the actual name of the assembly. You will also see things like
.assembly extern mscorlib
{
...
}
this is another assembly this one relies on (in this case mscorlib - one of the system assemblies). Notice it does not say mscorlib.dll or have any path information for the dll - just its name
At runtime the CLR loads the dependent assemblies on demand. I looks in the manifest, finds the name of the assembly and then runs an algorithm to map the name of the assembly to a physical dll. This process is called assembly resolution. If the manifest says
.assembly extern UtilLib
{
}
then if the assembly was strong named it would look in the global assembly cache (GAC) and then if not in there would start looking in the application directory and subdirectories, first for a file called UtilLib.dll and if that failed then UtilLib.exe. (this is a slight simplfication but gives you the general idea)
So as you can see - changing the file name you compile against will not change the actual name of the assembly - all it will do is stop the assembly being loaded at runtime - which is the symptom you are seeing. If you do not control the external assemblies then you cannot do what you are attempting.
Solution
Use reflector and reflexil to change the assembly
No comments:
Post a Comment