为什么 dll 改名字之后无法使用
有人直接把dll名字改了,我的程序运行出错,说这是我程序的问题,难道真是这样吗? 总感觉直接改dll名字不对,但哪儿不对呢,带着这样的疑惑研究了一下,重新做了一下试验,结果程序抛出了错误:
Could not load file or assembly 'AssemblyName' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
错误中提到了Assembly manifest 文件,那这个文件有接触,但是具体没有深入研究,到了微软官网查了一下关于mainifest的信息,
Each assembly's manifest performs the following functions:
- Enumerates the files that make up the assembly.
- Governs how references to the assembly's types and resources map to the files that contain their declarations and implementations.
- Enumerates other assemblies on which the assembly depends.
- Provides a level of indirection between consumers of the assembly and the assembly's implementation details.
- Renders the assembly self-describing.
Assembly Manifest Contents
The following table shows the information contained in the assembly manifest. The first four items — the assembly name, version number, culture, and strong name information — make up the assembly's identity.
| Information | Description |
|---|---|
| Assembly name | A text string specifying the assembly's name. |
| Version number | A major and minor version number, and a revision and build number. The common language runtime uses these numbers to enforce version policy. |
| Culture | Information on the culture or language the assembly supports. This information should be used only to designate an assembly as a satellite assembly containing culture- or language-specific information. (An assembly with culture information is automatically assumed to be a satellite assembly.) |
| Strong name information | The public key from the publisher if the assembly has been given a strong name. |
| List of all files in the assembly | A hash of each file contained in the assembly and a file name. Note that all files that make up the assembly must be in the same directory as the file containing the assembly manifest. |
| Type reference information | Information used by the runtime to map a type reference to the file that contains its declaration and implementation. This is used for types that are exported from the assembly. |
| Information on referenced assemblies | A list of other assemblies that are statically referenced by the assembly. Each reference includes the dependent assembly's name, assembly metadata (version, culture, operating system, and so on), and public key, if the assembly is strong named. |
上面红色文字部分说明manifest对assembly自身的信息进行了记录,从提示信息看可以推断出Assembly.Load(string assemblyName)是检测了dll 名字[具体代码保密无法看到],那就只能记住assembly不能随便改名字。
为什么 dll 改名字之后无法使用的更多相关文章
- Xcode换版本或者改名字后无法使用simpholders2
修改一下路径,在终端下输入下面的命令sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer 敲回车后 ...
- MySQL数据库改名字
在这里首先感谢那个网上已经给出了解决办法的同志 有很多MySQL数据库的初学者可能都会遇到一个关于改名字的问题,可能大家第一时间就会想到去网上搜搜,其实我跟大家的心理是一样的(呵呵). 据我所知,My ...
- 给tomcat7w.exe改名字
在平常使用tomcat的过程中,经常会在自己的电脑上安装两个tomcat,而且使用tomcat的tomcat7w.exe界面比较方便,即 但是两个tomcat的名字一样,也只能启动一个tomcat. ...
- myeclicps开发web时候复制一个工程改名字后执行出现404错误
当部署的时候会出现如下的警告,此时请按照如下的方法解决: 1.选择要运行的工程,右击-->properties-->在上边的搜索框中搜索web,选中web,将Web Context-roo ...
- Unity4.5版本DLL库名字问题
背景 在unity4.2版本中可以在Android中使用的so链接库,在Unity4.5中使不了-- [DllImport("libclient.so", EntryPoint ...
- 【转载】sudoers改坏后无法使用sudo的解决办法
练习安装odoo的时候,创建了一个odoo用户,想把它赋予sudo权限,然而,编辑的时候不留意,改坏了,导致sudo无法使用,无法编辑sudoers文件修改回来. 提示如下信息: >>&g ...
- [jnhs]使用netbeans生成的webapp发布到tomcat是需要改名字的,不然就是404Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
2018-12-21更新 退出tomcat然后删除解压之后的文件夹,然后再启动tomcat也可以解决(安装版tomcat) 2018-12-9更新 有时候这样也可以解决 第一次使用tomcat发布we ...
- git 本地分支和远程分支改名字
1.将本地分支进行改名: git branch -m old_branch new_branch 2.将本地分支的远程分支删除: git push origin :old_branch 3.将改名后的 ...
- /usr/lib64改名字风波
注:本文描述请勿模仿,仅限万一遇到这种情况一试. 一不小心做了一个操作: cd /usr mv lib64 lib64-bak 然后奇异的发现: cp不能用了!ls也不能用了…… 提示信息如下: -b ...
随机推荐
- 在vmware workstation10上安装ubuntu14.04,出现以下问题
VMware提示:已将该虚拟机配置为使用 64 位客户机操作系统.但是,无法执行 64 位操作. (1)设置bois 对于HP电脑来说,刚开机时,按住F10,会出现以下界面: 然后回车进行设置: 重启 ...
- 第一百二十三节,JavaScript错误处理与调试
JavaScript错误处理与调试 学习要点: 1.浏览器错误报告 2.错误处理 3.错误事件 4.错误处理策略 5.调试技术 6.调试工具 JavaScript在错误处理调试上一直是它的软肋,如果脚 ...
- jquery轻松实现li标签上下滚动的原理
在网站上我们常看到有滚动的文字或者图片,比如消息提醒,新闻列表,等等.那么这些效果是怎么形成的呢?经过查阅,找到一种十分方便的写法,经过改良,得出我自己的终极版滚动效果. 我先写个布局吧 <di ...
- 30分钟学习sea.js使用指南
: seajs如何解决? ①引入sea.js的库 <script src="../sea/sea.js" ></script> ②如何变成模块? defin ...
- contentType设置类型导致ajax post data 获取不到数据
ajax post data 获取不到数据,注意 content-type的设置 .post/get关于 jQuery data 传递数据.网上各种获取不到数据,乱码之类的. 好吧今天我也遇到了, ...
- 查询--游标 limit skip sort
打印出所有的里程: var cursor = db.tblDaily.find(); cursor.forEach(function(x){ print(x.DailyCount + x.DailyU ...
- ASP.NET使用ImageMap控件
文章来自:http://www.baike369.com/content/?id=5773
- 4天html总结
- 10s后自动跳转
<div class="jf_register"> <h2>您好,欢迎光临<fmt:message key="b2cShowName&quo ...
- 最新Node.js 资源汇总
Node.js 资源汇总 文档 Node.js 官方文档:http://nodejs.org/api/ Node.js 中文文档:http://nodejs.jsbin.cn/api/ Express ...