Assembly.ReflectionOnlyLoadFrom(String) 方法

定義

警告

ReflectionOnly loading is not supported and throws PlatformNotSupportedException.

將組件載入僅限反映的內容中,並指定其路徑。

public:
 static System::Reflection::Assembly ^ ReflectionOnlyLoadFrom(System::String ^ assemblyFile);
public static System.Reflection.Assembly ReflectionOnlyLoadFrom (string assemblyFile);
[System.Obsolete("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId="SYSLIB0018", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Reflection.Assembly ReflectionOnlyLoadFrom (string assemblyFile);
static member ReflectionOnlyLoadFrom : string -> System.Reflection.Assembly
[<System.Obsolete("ReflectionOnly loading is not supported and throws PlatformNotSupportedException.", DiagnosticId="SYSLIB0018", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member ReflectionOnlyLoadFrom : string -> System.Reflection.Assembly
Public Shared Function ReflectionOnlyLoadFrom (assemblyFile As String) As Assembly

參數

assemblyFile
String

檔案的路徑,該檔案包含組件的資訊清單。

傳回

載入的組件。

屬性

例外狀況

assemblyFilenull

找不到 assemblyFile,或您想載入的模組並未指定檔案的副檔名。

找到assemblyFile ,但無法載入。

assemblyFile 不是目前載入運行時間的有效元件。

指定了並非以 "file://" 開頭的程式碼基底,且沒有必要的 WebPermission

組件名稱超過系統定義的長度上限。

assemblyFile 為空字串 ("")。

僅限 .NET Core 與 .NET 5+:在所有情況下。

備註

相依性不會自動載入僅限反映的內容。 若要自動載入相依性,請處理 ReflectionOnlyAssemblyResolve 事件,並在事件處理程式中載入相依性。

您無法從已載入至僅限反映內容的元件執行程式代碼。 若要執行程式代碼,請使用 LoadFile 方法載入元件。

參數 assemblyFile 必須參考不含逸出字元的 URI。 這個方法會提供 URI 中所有無效字元的逸出字元。

指定的 assemblyFile 路徑是相對於目前目錄。

僅限反映的內容與其他內容並無不同。 載入內容中的元件只能卸除應用程式域來卸除。

適用於