简体   繁体   English

重命名ICSharpCode.SharpZipLib.dll

[英]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.

相关问题 icsharpcode SharpZipLib没有在zip文件上正确设置密码 - icsharpcode SharpZipLib is not setting password correctly on zip file ICSharpCode.SharpZipLib验证zip文件 - ICSharpCode.SharpZipLib validate zip file ICSharpCode.SharpZipLib 压缩方法不支持 PKZIP - ICSharpCode.SharpZipLib Compression method not supported PKZIP 发现无法解决的“ ICSharpCode.SharpZipLib”不同版本之间的冲突 - Found conflicts between different versions of “ICSharpCode.SharpZipLib” that could not be resolved 使用 zip 中的 ICSharpCode.SharpZipLib.Zip 子文件夹,当它不应该是 - Using ICSharpCode.SharpZipLib.Zip Subfolder in zip when its not supposed to be 如何使用ICSharpCode.SharpZipLib将文件夹添加到zip存档 - How do you add a folder to a zip archive with ICSharpCode.SharpZipLib 带有crc变量详细信息的ICSharpCode.SharpZipLib.Zip示例 - ICSharpCode.SharpZipLib.Zip example with crc variable details 使用ICSharpCode.SharpZipLib的项目的SQLCLR发布失败 - SQLCLR-Publish fail for project using ICSharpCode.SharpZipLib 如何使用 ICSharpCode.SharpZipLib 压缩文件数据并使用 HttpClient 上传? - How to compress file data with ICSharpCode.SharpZipLib and upload using HttpClient? 使用c#ICSharpCode.SharpZipLib将目录中的大量文件压缩 - Zipping large quantity of files in a directory using c# ICSharpCode.SharpZipLib
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM