[英]Renaming ICSharpCode.SharpZipLib.dll
well I am having a problem renaming the ICSharpCode.SharpZipLib.dll file to anythig else. 好,我在将ICSharpCode.SharpZipLib.dll文件重命名为其他任何问题。 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'.
它产生一个错误,即找不到程序集或文件“ ICSharpCode.SharpZipLib”。 When I change the file name back to ICSharpCode.SharpZipLib.dll the application works noramally.
当我将文件名更改回ICSharpCode.SharpZipLib.dll时,应用程序正常运行。 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. 您可以尝试反汇编该库,然后使用新名称重新进行组装。
Eg 例如
1) Open Visual Studio command prompt. 1)打开Visual Studio命令提示符。
ildasm /all /out=ICSharpCode.SharpZipLib.il ICSharpCode.SharpZipLib.dll
ilasm /dll /out=shortname.dll ICSharpCode.SharpZipLib.il
2) Add shortname.dll to the project 2)将shortname.dll添加到项目
SInce you renamed the DLL, the .Net runtime doesn't know how to find it automatically. 自重命名DLL以来,.Net运行时不知道如何自动查找它。
You can call Assembly.Load
to manually load the renamed file. 您可以调用
Assembly.Load
手动加载重命名的文件。
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. 请注意,在调用使用该程序集的任何方法之前,您需要这样做,因为JITter需要在该方法开始执行之前加载(直接)方法使用的所有类型。
The DLL is compiled so renaming the file will not change the namespace
's inside of it anyway. DLL已编译,因此重命名文件无论如何都不会更改
namespace
的内部。 You can assign an alias to it through a using
directive. 您可以通过
using
指令为其分配别名。
using zip = ICSharpCode.SharpZipLib;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.