I have some external DLLs that I want to use
But they have a long name that I want to change...
I just want to rename the DLL....
So I renamed it, removed his reference and then added it back from that file(That I renamed)
There are no errors so far, I see the namespace and all and I can use everything
Even when I build the project there are no errors
But when I am trying to run it:
"
Could not load file or assembly 'DevComponents.DotNetBar2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc612c9b701e96e0' or one of its dependencies. The system cannot find the file specified.
"
So I opened my project file with notepad and then I saw:
"
<Reference Include="UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc612c9b701e96e0, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>bin\Debug\UI.dll</HintPath>
</Reference>
"
I checked all the files in my project and I did not see any thing like DevComponents.DotNetBar2
So why does it do that?
Changing the name of a DLL
Started by bugale, Feb 21 2009 03:40 AM
3 replies to this topic
#1
Posted 21 February 2009 - 03:40 AM
|
|
|
#2
Posted 21 February 2009 - 06:11 AM
Is Ui.dll the original name of the dll that you renamed?
#3
Posted 21 February 2009 - 06:47 AM
Of course not
I want to change it
But I have already got the answer on another forum
This is the answer:
"
.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
"
I used reflector and reflexil to change the assembly and it worked.
I want to change it
But I have already got the answer on another forum
This is the answer:
"
.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
"
I used reflector and reflexil to change the assembly and it worked.


Sign In
Create Account

Back to top









