有人直接把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 改名字之后无法使用的更多相关文章

  1. Xcode换版本或者改名字后无法使用simpholders2

    修改一下路径,在终端下输入下面的命令sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer 敲回车后 ...

  2. MySQL数据库改名字

    在这里首先感谢那个网上已经给出了解决办法的同志 有很多MySQL数据库的初学者可能都会遇到一个关于改名字的问题,可能大家第一时间就会想到去网上搜搜,其实我跟大家的心理是一样的(呵呵). 据我所知,My ...

  3. 给tomcat7w.exe改名字

    在平常使用tomcat的过程中,经常会在自己的电脑上安装两个tomcat,而且使用tomcat的tomcat7w.exe界面比较方便,即 但是两个tomcat的名字一样,也只能启动一个tomcat. ...

  4. myeclicps开发web时候复制一个工程改名字后执行出现404错误

    当部署的时候会出现如下的警告,此时请按照如下的方法解决: 1.选择要运行的工程,右击-->properties-->在上边的搜索框中搜索web,选中web,将Web Context-roo ...

  5. Unity4.5版本DLL库名字问题

      背景 在unity4.2版本中可以在Android中使用的so链接库,在Unity4.5中使不了-- [DllImport("libclient.so", EntryPoint ...

  6. 【转载】sudoers改坏后无法使用sudo的解决办法

    练习安装odoo的时候,创建了一个odoo用户,想把它赋予sudo权限,然而,编辑的时候不留意,改坏了,导致sudo无法使用,无法编辑sudoers文件修改回来. 提示如下信息: >>&g ...

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

  8. git 本地分支和远程分支改名字

    1.将本地分支进行改名: git branch -m old_branch new_branch 2.将本地分支的远程分支删除: git push origin :old_branch 3.将改名后的 ...

  9. /usr/lib64改名字风波

    注:本文描述请勿模仿,仅限万一遇到这种情况一试. 一不小心做了一个操作: cd /usr mv lib64 lib64-bak 然后奇异的发现: cp不能用了!ls也不能用了…… 提示信息如下: -b ...

随机推荐

  1. 【android错误】bitmap size exceeds 32bits

    使用图片缩放时遇到这么个问题: java.lang.IllegalArgumentException: bitmap size exceeds 32bits 后来一行行查代码,发现原来是 scale ...

  2. git上传报错的解决方案

    刚创建的github版本库,在push代码时出错:$ git push -u origin masterTo git@github.com:******/Demo.git ! [rejected] m ...

  3. [SOJ]统计数字

    Description 某次科研调查时得到了n个自然数,每个数均不超过1500000000(1.5*10^9).已知不相同的数不超过10000个,现在需要统计这些自然数各自出现的次数,并按照自然数从小 ...

  4. [SOJ] DAG?

    Description 输入一个有向图,判断该图是否是有向无环图(Directed Acyclic Graph). Input 输入的第一行包含两个整数n和m,n是图的顶点数,m是边数.1<=n ...

  5. Java笔试题目-my

    1.BuildString  和 BefferedString  默认初始容量为 16 ,  超出就是 16*2 + 2;   可以看源代码得知; 2.ArrayList 默认的构造方法是一个空的Ob ...

  6. Redis--Latest Windows Version

    Redis Windows Ver https://github.com/MSOpenTech/redis/releases service-install.batredis-server.exe - ...

  7. ECOS-Mongodb安装

    安装Mongodb服务 安装Mongodb服务 author :James,jimingsong@vip.qq.com since :2015-03-03 下载Mongodb安装包(64位哦) 安装M ...

  8. Error pulling origin: error: Your local changes to the following files would be overwritten by merge

    Git在pull时,出现这种错误的时候,可能很多人进进行stash,相关stash的请看:Error pulling origin: error: Your local changes to the ...

  9. Mac Java maven环境变量

    p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #fffff ...

  10. JavaScript里利用DOM获取宽高大全

    网页可见区域宽:document.body.clientWidth网页可见区域高:document.body.clientHeight网页可见区域宽:document.body.offsetWidth ...