Table of Contents

Struct BundlerParameters

Namespace
AsmResolver.DotNet.Bundles
Assembly
AsmResolver.DotNet.dll

Defines parameters for the .NET application bundler.

public struct BundlerParameters
Inherited Members

Constructors

BundlerParameters(byte[], string)

Initializes new bundler parameters.

[Obsolete("Use BundlerParameters::FromTemplate instead.")]
public BundlerParameters(byte[] appHostTemplate, string appBinaryPath)

Parameters

appHostTemplate byte[]

The application host template file to use.

appBinaryPath string

The name of the file in the bundle that contains the entry point of the application.

BundlerParameters(byte[], string, IDataSource?)

Initializes new bundler parameters.

[Obsolete("Use BundlerParameters::FromTemplate instead.")]
public BundlerParameters(byte[] appHostTemplate, string appBinaryPath, IDataSource? imageToCopyHeadersFrom)

Parameters

appHostTemplate byte[]

The application host template file to use.

appBinaryPath string

The name of the file in the bundle that contains the entry point of the application.

imageToCopyHeadersFrom IDataSource

The binary to copy the PE headers and Win32 resources from. This is typically the original native executable file that hosts the CLR, or the original AppHost file the bundle was extracted from.

BundlerParameters(byte[], string, SubSystem, ResourceDirectory?)

Initializes new bundler parameters.

[Obsolete("Use BundlerParameters::FromTemplate instead.")]
public BundlerParameters(byte[] appHostTemplate, string appBinaryPath, SubSystem subSystem, ResourceDirectory? resources)

Parameters

appHostTemplate byte[]

The application host template file to use.

appBinaryPath string

The name of the file in the bundle that contains the entry point of the application.

subSystem SubSystem

The subsystem to use in the final Windows PE binary.

resources ResourceDirectory

The resources to copy into the final Windows PE binary.

BundlerParameters(byte[], string, PEImage?)

Initializes new bundler parameters.

[Obsolete("Use BundlerParameters::FromTemplate instead.")]
public BundlerParameters(byte[] appHostTemplate, string appBinaryPath, PEImage? imageToCopyHeadersFrom)

Parameters

appHostTemplate byte[]

The application host template file to use.

appBinaryPath string

The name of the file in the bundle that contains the entry point of the application.

imageToCopyHeadersFrom PEImage

The PE image to copy the headers and Win32 resources from. This is typically the original native executable file that hosts the CLR, or the original AppHost file the bundle was extracted from.

BundlerParameters(byte[], string, byte[]?)

Initializes new bundler parameters.

[Obsolete("Use BundlerParameters::FromTemplate instead.")]
public BundlerParameters(byte[] appHostTemplate, string appBinaryPath, byte[]? imageToCopyHeadersFrom)

Parameters

appHostTemplate byte[]

The application host template file to use.

appBinaryPath string

The name of the file in the bundle that contains the entry point of the application.

imageToCopyHeadersFrom byte[]

The binary to copy the PE headers and Win32 resources from. This is typically the original native executable file that hosts the CLR, or the original AppHost file the bundle was extracted from.

BundlerParameters(string, string)

Initializes new bundler parameters.

[Obsolete("Use BundlerParameters::FromTemplate instead.")]
public BundlerParameters(string appHostTemplatePath, string appBinaryPath)

Parameters

appHostTemplatePath string

The path to the application host file template to use. By default this is stored in <DOTNET-INSTALLATION-PATH>/sdk/<version>/AppHostTemplate or <DOTNET-INSTALLATION-PATH>/packs/Microsoft.NETCore.App.Host.<runtime-identifier>/<version>/runtimes/<runtime-identifier>/native.

appBinaryPath string

The name of the file in the bundle that contains the entry point of the application.

BundlerParameters(string, string, string?)

Initializes new bundler parameters.

[Obsolete("Use BundlerParameters::FromTemplate instead.")]
public BundlerParameters(string appHostTemplatePath, string appBinaryPath, string? imagePathToCopyHeadersFrom)

Parameters

appHostTemplatePath string

The path to the application host file template to use. By default this is stored in <DOTNET-INSTALLATION-PATH>/sdk/<version>/AppHostTemplate or <DOTNET-INSTALLATION-PATH>/packs/Microsoft.NETCore.App.Host.<runtime-identifier>/<version>/runtimes/<runtime-identifier>/native.

appBinaryPath string

The name of the file in the bundle that contains the entry point of the application.

imagePathToCopyHeadersFrom string

The path to copy the PE headers and Win32 resources from. This is typically the original native executable file that hosts the CLR, or the original AppHost file the bundle was extracted from.

Properties

ApplicationBinaryPath

Gets or sets the path to the binary within the bundle that contains the application's entry point.

public string ApplicationBinaryPath { readonly get; set; }

Property Value

string

ApplicationHostTemplate

Gets or sets the template application hosting binary.

public byte[] ApplicationHostTemplate { readonly get; set; }

Property Value

byte[]

Remarks

By default, the official implementations of the application host can be found in one of the following installation directories:

  • <DOTNET-INSTALLATION-PATH>/sdk/<version>/AppHostTemplate
  • <DOTNET-INSTALLATION-PATH>/packs/Microsoft.NETCore.App.Host.<runtime-identifier>/<version>/runtimes/<runtime-identifier>/native
It is therefore recommended to use the contents of one of these templates to ensure compatibility.

IsArm64Linux

Gets a value indicating whether the bundled executable targets the Linux operating system on ARM64.

public bool IsArm64Linux { readonly get; set; }

Property Value

bool

PathPlaceholder

Gets or sets the path placeholder in ApplicationHostTemplate that will be replaced with the contents of ApplicationBinaryPath.

public byte[] PathPlaceholder { readonly get; set; }

Property Value

byte[]

Resources

Gets or sets the Win32 resources directory to copy into the final PE executable.

public ResourceDirectory? Resources { readonly get; set; }

Property Value

ResourceDirectory

Remarks

This field is ignored if IsArm64Linux is set to true, or ApplicationHostTemplate does not contain a proper PE image.

SubSystem

Gets or sets the Windows subsystem the final PE executable should target.

public SubSystem SubSystem { readonly get; set; }

Property Value

SubSystem

Remarks

This field is ignored if IsArm64Linux is set to true, or ApplicationHostTemplate does not contain a proper PE image.

Methods

FromExistingBundle(byte[], string)

Extracts bundler parameters from an existing packaged bundled PE file.

public static BundlerParameters FromExistingBundle(byte[] originalFile, string appBinaryPath)

Parameters

originalFile byte[]

The raw contents of the original PE file.

appBinaryPath string

The name of the file in the bundle that contains the entry point of the application.

Returns

BundlerParameters

Remarks

This method uses heuristics to determine the right offsets within the existing apphost bundle file, and is not guaranteed to always produce the right bundler parameters.

FromExistingBundle(byte[], string, string)

Extracts bundler parameters from an existing packaged bundled PE file.

public static BundlerParameters FromExistingBundle(byte[] originalFile, string originalAppBinaryPath, string newAppBinaryPath)

Parameters

originalFile byte[]

The raw contents of the original PE file.

originalAppBinaryPath string

The original name of the file in the bundle that contains the entry point of the application.

newAppBinaryPath string

The new name of the file in the bundle that contains the entry point of the application.

Returns

BundlerParameters

Remarks

This method uses heuristics to determine the right offsets within the existing apphost bundle file, and is not guaranteed to always produce the right bundler parameters.

FromExistingBundle(string, string)

Extracts bundler parameters from an existing packaged bundled PE file.

public static BundlerParameters FromExistingBundle(string originalFile, string appBinaryPath)

Parameters

originalFile string

The path to the original PE file.

appBinaryPath string

The name of the file in the bundle that contains the entry point of the application.

Returns

BundlerParameters

Remarks

This method uses heuristics to determine the right offsets within the existing apphost bundle file, and is not guaranteed to always produce the right bundler parameters.

FromTemplate(byte[], string)

Initializes new bundler parameters from an apphost template.

public static BundlerParameters FromTemplate(byte[] appHostTemplate, string appBinaryPath)

Parameters

appHostTemplate byte[]

The application host template file to use.

appBinaryPath string

The name of the file in the bundle that contains the entry point of the application.

Returns

BundlerParameters

FromTemplate(byte[], string, PEImage?)

Initializes new bundler parameters from an apphost template.

public static BundlerParameters FromTemplate(byte[] appHostTemplate, string appBinaryPath, PEImage? imageToCopyHeadersFrom)

Parameters

appHostTemplate byte[]

The application host template file to use.

appBinaryPath string

The name of the file in the bundle that contains the entry point of the application.

imageToCopyHeadersFrom PEImage

The image to copy the PE headers and Win32 resources from. This is typically the original native executable file that hosts the CLR, or the original AppHost file the bundle was extracted from.

Returns

BundlerParameters

FromTemplate(byte[], string, byte[]?)

Initializes new bundler parameters from an apphost template.

public static BundlerParameters FromTemplate(byte[] appHostTemplate, string appBinaryPath, byte[]? imageToCopyHeadersFrom)

Parameters

appHostTemplate byte[]

The application host template file to use.

appBinaryPath string

The name of the file in the bundle that contains the entry point of the application.

imageToCopyHeadersFrom byte[]

The binary to copy the PE headers and Win32 resources from. This is typically the original native executable file that hosts the CLR, or the original AppHost file the bundle was extracted from.

Returns

BundlerParameters

FromTemplate(string, string)

Initializes new bundler parameters from an apphost template.

public static BundlerParameters FromTemplate(string appHostTemplatePath, string appBinaryPath)

Parameters

appHostTemplatePath string

The path to the application host file template to use. By default this is stored in <DOTNET-INSTALLATION-PATH>/sdk/<version>/AppHostTemplate or <DOTNET-INSTALLATION-PATH>/packs/Microsoft.NETCore.App.Host.<runtime-identifier>/<version>/runtimes/<runtime-identifier>/native.

appBinaryPath string

The name of the file in the bundle that contains the entry point of the application.

Returns

BundlerParameters

FromTemplate(string, string, string?)

Initializes new bundler parameters from an apphost template.

public static BundlerParameters FromTemplate(string appHostTemplatePath, string appBinaryPath, string? imagePathToCopyHeadersFrom)

Parameters

appHostTemplatePath string

The path to the application host file template to use. By default this is stored in <DOTNET-INSTALLATION-PATH>/sdk/<version>/AppHostTemplate or <DOTNET-INSTALLATION-PATH>/packs/Microsoft.NETCore.App.Host.<runtime-identifier>/<version>/runtimes/<runtime-identifier>/native.

appBinaryPath string

The name of the file in the bundle that contains the entry point of the application.

imagePathToCopyHeadersFrom string

The path to the binary to copy the PE headers and Win32 resources from. This is typically the original native executable file that hosts the CLR, or the original AppHost file the bundle was extracted from.

Returns

BundlerParameters