FileSystemExtensions.Emit Method

Definition

Emit the IL for the compilation into the specified stream.

C#
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);
C#
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);

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

Product Versions
Roslyn 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.7.0, 4.8.0, 4.9.2, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.3.1, 3.4.0, 3.5.0, 3.6.0, 3.7.0, 3.8.0, 3.9.0, 3.10.0, 3.11.0, 4.0.1, 4.1.0, 4.12.2, 4.13.0