AppDomainSetup.DisallowApplicationBaseProbing 属性

定义

指定在搜索要加载的程序集时是否探测应用程序基路径和专用二进制路径。Specifies whether the application base path and private binary path are probed when searching for assemblies to load.

public:
 property bool DisallowApplicationBaseProbing { bool get(); void set(bool value); };
public bool DisallowApplicationBaseProbing { get; set; }
member this.DisallowApplicationBaseProbing : bool with get, set
Public Property DisallowApplicationBaseProbing As Boolean

属性值

Boolean

如果不允许探测,则为true ;否则为 falsetrue if probing is not allowed; otherwise, false. 默认值为 falseThe default is false.

注解

如果 DisallowApplicationBaseProbing 属性为 true ,则忽略属性的值 ApplicationBaseIf the DisallowApplicationBaseProbing property is true, the value of the ApplicationBase property is ignored. 也就是说,不会在属性所指定的目录中探测程序集 ApplicationBaseThat is, no assemblies are probed for in the directories specified by the ApplicationBase property. 此外,将 PrivateBinPath 忽略属性和属性的值 PrivateBinPathProbeIn addition, the values of the PrivateBinPath property and the PrivateBinPathProbe property are ignored. 不会在属性所指定的目录中探测到的程序集 PrivateBinPathNo assemblies are probed for in the directories specified by the PrivateBinPath property.

DisallowApplicationBaseProbing属性提供了对加载过程的附加控制层。The DisallowApplicationBaseProbing property provides an additional layer of control over the loading process. 在常规程序集加载序列中,在引发事件之前会探测应用程序基 AppDomain.AssemblyResolveIn the normal assembly loading sequence, the application base is probed before the AppDomain.AssemblyResolve event is raised. 但是,某些应用程序可能需要从文档内的 OLE 复合文件,或从非全局程序集缓存中或和属性指定的目录中的唯一已知位置加载程序集 ApplicationBase PrivateBinPathHowever, some applications might need to load assemblies from an OLE compound file within a document, or from a unique known location that is neither in the global assembly cache nor in the directories specified by the ApplicationBase and PrivateBinPath properties. 此类应用程序可使用 DisallowApplicationBaseProbing 属性来避免正常探测导致的延迟,并避免加载可能位于正常探测路径中的必要程序集的副本。Such applications can use the DisallowApplicationBaseProbing property to avoid the delay caused by normal probing, and to avoid loading copies of the necessary assembly that might be located in the normal probing paths.

适用于