原文:指定程序集的位置 | Microsoft Docs

指定程序集的位置Specifying an Assembly's Location

  • 2017/03/30
  • 作者
  1. 使用<b a s e > 元素
  2. 使用<探测 > 元素
  3. 请参阅

有两种方法来指定程序集的位置:There are two ways to specify an assembly's location:

此外可以使用.NET Framework 配置工具 (Mscorcfg.msc)来指定程序集的位置或指定公共语言运行时来探测程序集的位置。You can also use the .NET Framework Configuration Tool (Mscorcfg.msc) to specify assembly locations or specify locations for the common language runtime to probe for assemblies.

使用<b a s e > 元素Using the <codeBase> Element

可以使用 <b a s e > 只能机配置或发布服务器策略在文件中还将程序集版本重定向的元素。You can use the <codeBase> element only in machine configuration or publisher policy files that also redirect the assembly version. 当运行时确定要使用的程序集版本时,则会应用确定版本的文件的基本代码设置。When the runtime determines which assembly version to use, it applies the code base setting from the file that determines the version. 如果指示没有基本代码,运行时探测程序集以正常方式。If no code base is indicated, the runtime probes for the assembly in the normal way. 有关详细信息,请参阅运行时如何定位程序集。For details, see How the Runtime Locates Assemblies.

下面的示例演示如何指定程序集的位置。The following example shows how to specify an assembly's location.

XML 复制
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="en-us" />
<codeBase version="2.0.0.0"
href="http://www.litwareinc.com/myAssembly.dll"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

版本属性是必需的所有强名称的程序集,但不是具有强名称的程序集,应省略。The version attribute is required for all strong-named assemblies but should be omitted for assemblies that are not strong-named. *<B a s e >* 元素需要**href**属性。The <codeBase> element requires the href attribute. 不能指定版本范围 <b a s e > 元素。You cannot specify version ranges in the <codeBase> element.

备注

如果你所提供的不是强名称的程序集的基本代码的提示,提示必须指向应用程序基控件或应用程序基目录的子目录。If you are supplying a code base hint for an assembly that is not strong-named, the hint must point to the application base or a subdirectory of the application base directory.

使用<探测 > 元素Using the <probing> Element

运行时定位程序集不具有通过探测的基本代码。The runtime locates assemblies that do not have a code base by probing. 探测的详细信息,请参阅运行时如何定位程序集。For more information about probing, see How the Runtime Locates Assemblies.

可以使用<探测 >应用程序配置文件来指定运行时查找程序集时应搜索的子目录中的元素。You can use the <probing> element in the application configuration file to specify subdirectories the runtime should search when locating an assembly. 下面的示例演示如何指定运行时应搜索的目录。The following example shows how to specify directories the runtime should search.复制

<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin;bin2\subbin;bin3"/>
</assemblyBinding>
</runtime>
</configuration>

PrivatePath属性包含运行时应搜索程序集的目录。The privatePath attribute contains the directories that the runtime should search for assemblies. 如果应用程序位于 C:\Program Files\MyApp,运行时将查找 C:\Program Files\MyApp\Bin、 C:\Program Files\MyApp\Bin2\Subbin 和 C:\Program Files\MyApp\Bin3 中未指定基本代码的程序集。If the application is located at C:\Program Files\MyApp, the runtime will look for assemblies that do not specify a code base in C:\Program Files\MyApp\Bin, C:\Program Files\MyApp\Bin2\Subbin, and C:\Program Files\MyApp\Bin3. 中指定的目录privatePath必须是应用程序基目录的子目录。The directories specified in privatePath must be subdirectories of the application base directory.

请参阅See also

指定程序集的位置 | Microsoft Docs的更多相关文章

  1. .NET指定程序集的位置

    有两种方法用来指定程序集的位置: 使用 <codeBase> 元素. 使用 <probing> 元素. 还可以使用 .NET Framework 配置工具 (Mscorcfg. ...

  2. 开始使用 Docker (Linux 上运行 SQL Server) 上的 SQL Server 容器 - SQL Server | Microsoft Docs

    原文:开始使用 Docker (Linux 上运行 SQL Server) 上的 SQL Server 容器 - SQL Server | Microsoft Docs 快速入门:使用 Docker ...

  3. 分析器错误消息: 类型“test.test.testx”不明确: 它可能来自程序集“F:\testProject\bin\test.test.DLL”或程序集“F:\testProject\bin \testProject.DLL”。请在类型名称中显式指定程序集。

    问题描述: RT 分析器错误消息: 类型“test.test.testx”不明确: 它可能来自程序集“F:\testProject\bin\test.test.DLL”或程序集“F:\testProj ...

  4. vb6源码后台点击任意窗口指定坐标XY位置,支持FLASH和一般的游戏

    vb6源码后台点击任意窗口指定坐标XY位置,支持FLASH和一般的游戏,支持每个网页用不同的IP登陆,支持多线程自动点击 适合自动打怪,游戏练级,配合自动识图功能,自动验证码技术,可以实现更多功能. ...

  5. vscode指定扩展安装位置

    默认情况下,(Windows)vscode的安装路径为C:\Users\用户名\.vscode\extensions. 如果想要自定义扩展的安装路径,无法直接在vscode中修改.但是,在启动vsco ...

  6. OSG漫游到指定坐标点位置

    OSG中从当前场景位置漫游到指定点坐标位置,osg中场景的视口状态包括如下参数: 1.视点的位置 2.参考点的位置,该点通常为场景中的中心轴上的点 3.视点向上的方向向量 ( const osg::V ...

  7. 使用Hbuilder开发IOS应用上架审核提示请指定用户在位置许可模式警报中使用位置的预定用途。

    使用Hbuilder开发IOS应用时,遇到上架App被拒的问题,被拒原因: 你的应用程序使用位置服务,但并没有按照iOS人机界面指南中的要求,在位置模式警报中阐明它的用途. 要解决此问题,请指定用户在 ...

  8. 零元学Expression Blend 4 &ndash; Chapter 43 如何指定Childwindow PopUp位置

    原文:零元学Expression Blend 4 – Chapter 43 如何指定Childwindow PopUp位置 有网友询问我有关Childwindow是否能指定弹出位置? 其实只要透过小小 ...

  9. JS---动画函数封装:设置任意的一个元素,移动到指定的目标位置

    动画函数封装:设置任意的一个元素,移动到指定的目标位置 <!DOCTYPE html> <html lang="en"> <head> < ...

随机推荐

  1. 封装了一个HOOKAPI的类。。。

    我惊奇地发现,我手竟然这么生了.....   很久很久没有写这方面的东西,现在写着竟然这么手生....哎....   这玩艺,还得天天练....

  2. ORA-01790: 表达式必须具有与对应表达式相同的数据类型

    出现这种错误,要先看一下是不是sql中有用到连接:union,unio all之类的,如果有,需要注意相同名称字段的数据类型一定要相同.

  3. 系统负载load

    一.查看系统负荷 如果你的电脑很慢,你或许想查看一下,它的工作量是否太大了. 在Linux系统中,我们一般使用uptime命令查看(w命令和top命令也行).(另外,它们在苹果公司的Mac电脑上也适用 ...

  4. 初识css3 3d动画效果

    (先看我博客右上角的3d盒子动画效果,目前没做兼容处理,最好最新的chrome看)无意间看到网上css3写的3d动画效果,实在炫酷,以前理解为需要js去计算去写,没想到css直接可以实现.于是开始研究 ...

  5. Putty保存设置

    使用putty连接服务器每次都要配置编码,有时候忘了配置,提示就出现中文乱码真是坑爹(纯英文提示也行啊),好了闲话少说,步入正题. Putty的设置保存功能隐藏的实在太好了,原来在Connection ...

  6. eclipse环境问题-java版本不兼容

    有时候虽然我们给项目配置的jdk版本.项目编译版本都一直,但是还是会报如下的错误: Description Resource Path Location Type Java compiler leve ...

  7. day1(老男孩-Python3.5-S14期全栈开发)

    作者:赵俊            发布日期:2019/10/18 一.第一个python程序 1.在解释器下写hello world程序运行,与运行外部文件方法 运行外部文件,必须在相应位置创建一个p ...

  8. Finalize什么时候被调用

    Finalize方法在垃圾回收结束时被调用,有五种一下情况会导致开始垃圾回收. 第0代已满  第0代满时,垃圾回收会自动开始.改时间是目前导致Finalize方法被调用的最常见的一种方式,因为随着应用 ...

  9. jmeter-监听器介绍与使用

    12.jmeter-监听器介绍与使用 jmeter-监听器介绍与使用 察看结果树 Summary Report 聚合报告 Backend Listener Aggregate Graph 断言结果 C ...

  10. 设置div背景图片填满div

    可以设置div的样式为 background:url('+UPLOAD_PATH+data.url+') no-repeat; background-size: 100%;width:100%;hei ...