Partilhar via


FileSystemExtensions.Emit Method

Definition

Emit the IL for the compilation into the specified stream.

public static Microsoft.CodeAnalysis.Emit.EmitResult Emit (this Microsoft.CodeAnalysis.Compilation compilation, string outputPath, string pdbPath = default, string xmlDocPath = default, string win32ResourcesPath = default, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ResourceDescription> manifestResources = default, System.Threading.CancellationToken cancellationToken = default);
public static Microsoft.CodeAnalysis.Emit.EmitResult Emit (this Microsoft.CodeAnalysis.Compilation compilation, string outputPath, string? pdbPath = default, string? xmlDocPath = default, string? win32ResourcesPath = default, System.Collections.Generic.IEnumerable<Microsoft.CodeAnalysis.ResourceDescription>? manifestResources = default, System.Threading.CancellationToken cancellationToken = default);
static member Emit : Microsoft.CodeAnalysis.Compilation * string * string * string * string * seq<Microsoft.CodeAnalysis.ResourceDescription> * System.Threading.CancellationToken -> Microsoft.CodeAnalysis.Emit.EmitResult
<Extension()>
Public Function Emit (compilation As Compilation, outputPath As String, Optional pdbPath As String = Nothing, Optional xmlDocPath As String = Nothing, Optional win32ResourcesPath As String = Nothing, Optional manifestResources As IEnumerable(Of ResourceDescription) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As EmitResult

Parameters

compilation
Compilation

Compilation.

outputPath
String

Path of the file to which the compilation will be written.

pdbPath
String

Path of the file to which the compilation's debug info will be written. Also embedded in the output file. Null to forego PDB generation.

xmlDocPath
String

Path of the file to which the compilation's XML documentation will be written. Null to forego XML generation.

win32ResourcesPath
String

Path of the file from which the compilation's Win32 resources will be read (in RES format).
Null to indicate that there are none.

manifestResources
IEnumerable<ResourceDescription>

List of the compilation's managed resources. Null to indicate that there are none.

cancellationToken
CancellationToken

To cancel the emit process.

Returns

Exceptions

Compilation or path is null.

Path is empty or invalid.

An error occurred while reading or writing a file.

Applies to