Renaming ICSharpCode.SharpZipLib.dll
well I am having a problem renaming the ICSharpCode.SharpZipLib.dll file to anythig else. I am trying to shorten the file name. I reference the assembly in the project, but when the program reaches the statements where I use the library. It spawns an error that it could not find the assembly or file 'ICSharpCode.SharpZipLib'. When I change the file name back to ICSharpCode.SharpZipLib.dll the application works noramally. So,开发者_开发知识库 is there any way to change the file name. Also, am I allowed to change it without violating the license (I am going to use it in a commercial application). Thanks.
You could try to disassemble the library and then re-assemble with a new name.
E.g.
1) Open Visual Studio command prompt.
ildasm /all /out=ICSharpCode.SharpZipLib.il ICSharpCode.SharpZipLib.dll
ilasm /dll /out=shortname.dll ICSharpCode.SharpZipLib.il
2) Add shortname.dll to the project
SInce you renamed the DLL, the .Net runtime doesn't know how to find it automatically.
You can call Assembly.Load
to manually load the renamed file.
Note that you'll need to do that before calling any methods that use the assembly, since the JITter needs to load all types used (directly) by a method before the method starts executing.
The DLL is compiled so renaming the file will not change the namespace
's inside of it anyway. You can assign an alias to it through a using
directive.
using zip = ICSharpCode.SharpZipLib;
精彩评论