有人直接把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. UGUI事件系统

    UGUI系统 将UI可能触发的事件分为12个类型,即EventTriggerType枚举的12个值. PointerEnter-- PointerExit-- PointerDown-- Pointe ...

  2. swift3.0 原生GET请求 POST同理

    swift3.0 原生GET请求  POST同理 func getrequest(){ let url = URL(string: "http://117.135.196.139:" ...

  3. 浅谈html入门

    一. 学习web前端开发基础技术需要掌握:HTML.CSS.JavaScript语言.下面就来了解下这三门技术都是用来实现什么的:1. HTML是网页内容的载体.内容就是网页制作者放在页面上想要让用户 ...

  4. java中使用数组和链表简单实现SJBMap

    import java.util.LinkedList; public class SJBMap { private Object[] elementData; private int size; p ...

  5. Metrics-Java版的指标度量工具

    介绍 Metrics是一个给JAVA服务的各项指标提供度量工具的包,在JAVA代码中嵌入Metrics代码,可以方便的对业务代码的各个指标进行监控,同时,Metrics能够很好的跟Ganlia.Gra ...

  6. TypeScript 学习一 参数,函数,析构表达式

    1,TypeScript是由谷歌开发的,并且新出的Angular2框架就是谷歌公司由TypeScript语言编写的,所以现在TypeScript是有微软和谷歌一起支持的: 2,TypeScript在j ...

  7. WIN7x64+VS2010+OpenCV2.4.10+cmake3.5.0重新编译OpenCV

    1,参考博文 Win7x64+VS2012+OpenCV2.4.3+CMake2.8.10+TBB41重编译OpenCV [OpenCV入门教程之七] 玩转OpenCV源代码:生成OpenCV工程解决 ...

  8. 利用requestjs优化响应式移动端js加载

    html: <script data-main="main" src="require.js"></script> main.js re ...

  9. javaMail邮件发送的简单实现

    package com.test.mail; import java.util.Properties; import javax.mail.Message; import javax.mail.Ses ...

  10. MongoDB本地安装与启用(windows )

    MongoDB的安装与MongoDB服务配置 Mongo DB 是目前在IT行业非常流行的一种非关系型数据库(NoSql),其灵活的数据存储方式备受当前IT从业人员的青睐.Mongo DB很好的实现了 ...