Share via


MetadataReference.CreateFromAssembly Method

Definition

Overloads

CreateFromAssembly(Assembly)
Obsolete.

Creates a reference to a loaded assembly.

CreateFromAssembly(Assembly, MetadataReferenceProperties, DocumentationProvider)
Obsolete.

Creates a reference to a loaded assembly.

CreateFromAssembly(Assembly)

Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs

Caution

Use CreateFromFile(assembly.Location) instead

Creates a reference to a loaded assembly.

public:
 static Microsoft::CodeAnalysis::MetadataReference ^ CreateFromAssembly(System::Reflection::Assembly ^ assembly);
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
[System.Obsolete("Use CreateFromFile(assembly.Location) instead", true)]
public static Microsoft.CodeAnalysis.MetadataReference CreateFromAssembly (System.Reflection.Assembly assembly);
[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]
[<System.Obsolete("Use CreateFromFile(assembly.Location) instead", true)>]
static member CreateFromAssembly : System.Reflection.Assembly -> Microsoft.CodeAnalysis.MetadataReference
Public Shared Function CreateFromAssembly (assembly As Assembly) As MetadataReference

Parameters

assembly
Assembly

Path to the module file.

Returns

Attributes

Exceptions

assembly is null.

assembly is dynamic, doesn't have a location, or the platform doesn't support reading from the location.

Remarks

Performance considerations:

It is recommended to use CreateFromFile(String) API when creating multiple references to the same assembly. Reusing AssemblyMetadata object allows for sharing data across these references.

Applies to

CreateFromAssembly(Assembly, MetadataReferenceProperties, DocumentationProvider)

Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs
Source:
MetadataReference.cs

Caution

Use CreateFromFile(assembly.Location) instead

Creates a reference to a loaded assembly.

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
[System.Obsolete("Use CreateFromFile(assembly.Location) instead", true)]
public static Microsoft.CodeAnalysis.MetadataReference CreateFromAssembly (System.Reflection.Assembly assembly, Microsoft.CodeAnalysis.MetadataReferenceProperties properties, Microsoft.CodeAnalysis.DocumentationProvider documentation = default);
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
[System.Obsolete("Use CreateFromFile(assembly.Location) instead", true)]
public static Microsoft.CodeAnalysis.MetadataReference CreateFromAssembly (System.Reflection.Assembly assembly, Microsoft.CodeAnalysis.MetadataReferenceProperties properties, Microsoft.CodeAnalysis.DocumentationProvider? documentation = default);
[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]
[<System.Obsolete("Use CreateFromFile(assembly.Location) instead", true)>]
static member CreateFromAssembly : System.Reflection.Assembly * Microsoft.CodeAnalysis.MetadataReferenceProperties * Microsoft.CodeAnalysis.DocumentationProvider -> Microsoft.CodeAnalysis.MetadataReference
Public Shared Function CreateFromAssembly (assembly As Assembly, properties As MetadataReferenceProperties, Optional documentation As DocumentationProvider = Nothing) As MetadataReference

Parameters

assembly
Assembly

Path to the module file.

properties
MetadataReferenceProperties

Reference properties (extern aliases, type embedding).

documentation
DocumentationProvider

Provides XML documentation for symbol found in the reference.

Returns

Attributes

Exceptions

assembly is null.

properties.Kind is not Assembly.

assembly is dynamic, doesn't have a location, or the platform doesn't support reading from the location.

Remarks

Performance considerations:

It is recommended to use CreateFromFile(String) API when creating multiple references to the same assembly. Reusing AssemblyMetadata object allows for sharing data across these references.

Applies to