Delen via


CSharpFileSystemExtensions.Emit Method

Definition

Emit the IL for the compilation into the specified stream.

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

Parameters

compilation
CSharpCompilation

Compilation.

outputPath
String

Path of the file to which the PE image 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.

xmlDocumentationPath
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