Assembly.ReflectionOnlyLoadFrom(String) Assembly.ReflectionOnlyLoadFrom(String) Assembly.ReflectionOnlyLoadFrom(String) Assembly.ReflectionOnlyLoadFrom(String) Method


将给定路径的程序集加载到只反射上下文中。Loads an assembly into the reflection-only context, given its path.

 static System::Reflection::Assembly ^ ReflectionOnlyLoadFrom(System::String ^ assemblyFile);
public static System.Reflection.Assembly ReflectionOnlyLoadFrom (string assemblyFile);
static member ReflectionOnlyLoadFrom : string -> System.Reflection.Assembly
Public Shared Function ReflectionOnlyLoadFrom (assemblyFile As String) As Assembly


String String String String

包含程序集清单的文件的路径。The path of the file that contains the manifest of the assembly.


加载的程序集。The loaded assembly.


未找到 assemblyFile,或者你正在试图加载的模块未指定文件扩展名。assemblyFile is not found, or the module you are trying to load does not specify a file name extension.

assemblyFile 已找到,但无法加载。assemblyFile is found, but could not be loaded.

assemblyFile 不是有效的程序集。assemblyFile is not a valid assembly.

- 或 --or- 当前加载的是公共语言运行时 2.0 版或更高版本,而 assemblyFile 是用更高的版本编译的。Version 2.0 or later of the common language runtime is currently loaded and assemblyFile was compiled with a later version.

指定了不以“file://”开头的基本代码,且没有所需的 WebPermissionA codebase that does not start with "file://" was specified without the required WebPermission.

程序集名称超过系统定义的最大长度。The assembly name exceeds the system-defined maximum length.

assemblyFile 为空字符串 ("")。assemblyFile is an empty string ("").


依赖项不会自动加载到只反射上下文中。Dependencies are not automatically loaded into the reflection-only context. 若要自动加载依赖项,请处理ReflectionOnlyAssemblyResolve事件和负载中的事件处理程序的依赖项。To automatically load dependencies, handle the ReflectionOnlyAssemblyResolve event and load the dependency in the event handler.

无法从程序集已加载到只反射上下文中执行代码。You cannot execute code from an assembly that has been loaded into the reflection-only context. 若要执行的代码,加载的程序集中LoadFile方法。To execute the code, load the assembly with the LoadFile method.

assemblyFile参数必须引用不包含转义符的 URI。The assemblyFile parameter must refer to a URI without escape characters. 此方法提供的 URI 中的所有无效字符的转义符。This method supplies escape characters for all invalid characters in the URI.

为指定的路径assemblyFile是相对于当前目录。The path specified for assemblyFile is relative to the current directory. 程序集被加载到调用方的域。The assembly is loaded into the domain of the caller.

仅限反射上下文是与其他上下文中没有什么不同。The reflection-only context is no different from other contexts. 可以仅通过卸载应用程序域卸载到上下文中加载的程序集。Assemblies that are loaded into the context can be unloaded only by unloading the application domain.


用于读取以"file://"开头的 URI。for reading a URI that begins with "file://". 关联枚举: ReadPathDiscoveryAssociated enumerations: Read, PathDiscovery

用于读取不以"file://"开头的 URI。for reading a URI that does not begin with "file://".