Struct netcorehost::hostfxr::Hostfxr [−][src]
pub struct Hostfxr { /* fields omitted */ }
Expand description
A struct representing a loaded hostfxr library.
Implementations
Loads the hostfxr library from the given path.
Locates the hostfxr library using nethost
and loads it.
pub fn initialize_for_dotnet_command_line(
&self,
app_path: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForCommandLine>, Error>
pub fn initialize_for_dotnet_command_line(
&self,
app_path: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForCommandLine>, Error>
Initializes the hosting components for a dotnet command line running an application
Like all the other initialize
functions, this function will
- Process the
.runtimeconfig.json
- Resolve framework references and find actual frameworks
- Find the root framework (
Microsoft.NETCore.App
) and load the hostpolicy from it - The hostpolicy will then process all relevant
.deps.json
files and produce the list of assemblies, native search paths and other artifacts needed to initialize the runtime.
The functions will NOT load the CoreCLR runtime. They just prepare everything to the point where it can be loaded.
Arguments
app_path
: The path to the target application.
Remarks
This function parses the specified command-line arguments to determine the application to run. It will
then find the corresponding .runtimeconfig.json
and .deps.json
with which to resolve frameworks and
dependencies and prepare everything needed to load the runtime.
pub fn initialize_for_dotnet_command_line_with_host_path(
&self,
app_path: impl AsRef<PdCStr>,
host_path: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForCommandLine>, Error>
pub fn initialize_for_dotnet_command_line_with_host_path(
&self,
app_path: impl AsRef<PdCStr>,
host_path: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForCommandLine>, Error>
Initializes the hosting components for a dotnet command line running an application
Like all the other initialize
functions, this function will
- Process the
.runtimeconfig.json
- Resolve framework references and find actual frameworks
- Find the root framework (
Microsoft.NETCore.App
) and load the hostpolicy from it - The hostpolicy will then process all relevant
.deps.json
files and produce the list of assemblies, native search paths and other artifacts needed to initialize the runtime.
The functions will NOT load the CoreCLR runtime. They just prepare everything to the point where it can be loaded.
Arguments
app_path
: The path to the target application.host_path
: Path to the native host (typically the.exe
). This value is not used for anything by the hosting components. It’s just passed to the CoreCLR as the path to the executable. It can point to a file which is not executable itself, if such file doesn’t exist (for example in COM activation scenarios this points to thecomhost.dll
). This is used by PAL to initialize internal command line structures, process name and so on.
Remarks
This function parses the specified command-line arguments to determine the application to run. It will
then find the corresponding .runtimeconfig.json
and .deps.json
with which to resolve frameworks and
dependencies and prepare everything needed to load the runtime.
pub fn initialize_for_dotnet_command_line_with_dotnet_root(
&self,
app_path: impl AsRef<PdCStr>,
dotnet_root: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForCommandLine>, Error>
pub fn initialize_for_dotnet_command_line_with_dotnet_root(
&self,
app_path: impl AsRef<PdCStr>,
dotnet_root: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForCommandLine>, Error>
Initializes the hosting components for a dotnet command line running an application
Like all the other initialize
functions, this function will
- Process the
.runtimeconfig.json
- Resolve framework references and find actual frameworks
- Find the root framework (
Microsoft.NETCore.App
) and load the hostpolicy from it - The hostpolicy will then process all relevant
.deps.json
files and produce the list of assemblies, native search paths and other artifacts needed to initialize the runtime.
The functions will NOT load the CoreCLR runtime. They just prepare everything to the point where it can be loaded.
Arguments
app_path
: The path to the target application.dotnet_root
: Path to the root of the .NET Core installation in use. This typically points to the install location from which the hostfxr has been loaded. For example on Windows this would typically point toC:\Program Files\dotnet
. The path is used to search for shared frameworks and potentially SDKs.
Remarks
This function parses the specified command-line arguments to determine the application to run. It will
then find the corresponding .runtimeconfig.json
and .deps.json
with which to resolve frameworks and
dependencies and prepare everything needed to load the runtime.
pub fn initialize_for_dotnet_command_line_with_args(
&self,
args: &[&PdCStr]
) -> Result<HostfxrContext<'_, InitializedForCommandLine>, Error>
pub fn initialize_for_dotnet_command_line_with_args(
&self,
args: &[&PdCStr]
) -> Result<HostfxrContext<'_, InitializedForCommandLine>, Error>
Initializes the hosting components for a dotnet command line running an application
Like all the other initialize
functions, this function will
- Process the
.runtimeconfig.json
- Resolve framework references and find actual frameworks
- Find the root framework (
Microsoft.NETCore.App
) and load the hostpolicy from it - The hostpolicy will then process all relevant
.deps.json
files and produce the list of assemblies, native search paths and other artifacts needed to initialize the runtime.
The functions will NOT load the CoreCLR runtime. They just prepare everything to the point where it can be loaded.
Arguments
args
: The command line for running a managed application. These represent the arguments which would have been passed to the muxer if the app was being run from the command line. Note that the first argument has to be the path of the target app.
Remarks
This function parses the specified command-line arguments to determine the application to run. It will
then find the corresponding .runtimeconfig.json
and .deps.json
with which to resolve frameworks and
dependencies and prepare everything needed to load the runtime.
pub fn initialize_for_dotnet_command_line_with_args_and_host_path(
&self,
args: &[&PdCStr],
host_path: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForCommandLine>, Error>
pub fn initialize_for_dotnet_command_line_with_args_and_host_path(
&self,
args: &[&PdCStr],
host_path: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForCommandLine>, Error>
Initializes the hosting components for a dotnet command line running an application
Like all the other initialize
functions, this function will
- Process the
.runtimeconfig.json
- Resolve framework references and find actual frameworks
- Find the root framework (
Microsoft.NETCore.App
) and load the hostpolicy from it - The hostpolicy will then process all relevant
.deps.json
files and produce the list of assemblies, native search paths and other artifacts needed to initialize the runtime.
The functions will NOT load the CoreCLR runtime. They just prepare everything to the point where it can be loaded.
Arguments
args
: The command line for running a managed application. These represent the arguments which would have been passed to the muxer if the app was being run from the command line. Note that the first argument has to be the path of the target app.host_path
: Path to the native host (typically the.exe
). This value is not used for anything by the hosting components. It’s just passed to the CoreCLR as the path to the executable. It can point to a file which is not executable itself, if such file doesn’t exist (for example in COM activation scenarios this points to thecomhost.dll
). This is used by PAL to initialize internal command line structures, process name and so on.
Remarks
This function parses the specified command-line arguments to determine the application to run. It will
then find the corresponding .runtimeconfig.json
and .deps.json
with which to resolve frameworks and
dependencies and prepare everything needed to load the runtime.
pub fn initialize_for_dotnet_command_line_with_args_and_dotnet_root(
&self,
args: &[&PdCStr],
dotnet_root: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForCommandLine>, Error>
pub fn initialize_for_dotnet_command_line_with_args_and_dotnet_root(
&self,
args: &[&PdCStr],
dotnet_root: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForCommandLine>, Error>
Initializes the hosting components for a dotnet command line running an application
Like all the other initialize
functions, this function will
- Process the
.runtimeconfig.json
- Resolve framework references and find actual frameworks
- Find the root framework (
Microsoft.NETCore.App
) and load the hostpolicy from it - The hostpolicy will then process all relevant
.deps.json
files and produce the list of assemblies, native search paths and other artifacts needed to initialize the runtime.
The functions will NOT load the CoreCLR runtime. They just prepare everything to the point where it can be loaded.
Arguments
args
: The command line for running a managed application. These represent the arguments which would have been passed to the muxer if the app was being run from the command line. Note that the first argument has to be the path of the target app.dotnet_root
: Path to the root of the .NET Core installation in use. This typically points to the install location from which the hostfxr has been loaded. For example on Windows this would typically point toC:\Program Files\dotnet
. The path is used to search for shared frameworks and potentially SDKs.
Remarks
This function parses the specified command-line arguments to determine the application to run. It will
then find the corresponding .runtimeconfig.json
and .deps.json
with which to resolve frameworks and
dependencies and prepare everything needed to load the runtime.
pub fn initialize_for_runtime_config(
&self,
runtime_config_path: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForRuntimeConfig>, Error>
pub fn initialize_for_runtime_config(
&self,
runtime_config_path: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForRuntimeConfig>, Error>
This function loads the specified .runtimeconfig.json
, resolve all frameworks, resolve all the assets from those frameworks and
then prepare runtime initialization where the TPA contains only frameworks.
Note that this case does NOT consume any .deps.json
from the app/component (only processes the framework’s .deps.json
).
Like all the other initialize
functions, this function will
- Process the
.runtimeconfig.json
- Resolve framework references and find actual frameworks
- Find the root framework (
Microsoft.NETCore.App
) and load the hostpolicy from it - The hostpolicy will then process all relevant
.deps.json
files and produce the list of assemblies, native search paths and other artifacts needed to initialize the runtime.
The functions will NOT load the CoreCLR runtime. They just prepare everything to the point where it can be loaded.
Arguments
runtime_config_path
: Path to the.runtimeconfig.json
file to process. Unlike withinitialize_for_dotnet_command_line
, any.deps.json
from the app/component will not be processed by the hosting layers.
pub fn initialize_for_runtime_config_with_host_path(
&self,
runtime_config_path: impl AsRef<PdCStr>,
host_path: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForRuntimeConfig>, Error>
pub fn initialize_for_runtime_config_with_host_path(
&self,
runtime_config_path: impl AsRef<PdCStr>,
host_path: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForRuntimeConfig>, Error>
This function loads the specified .runtimeconfig.json
, resolve all frameworks, resolve all the assets from those frameworks and
then prepare runtime initialization where the TPA contains only frameworks.
Note that this case does NOT consume any .deps.json
from the app/component (only processes the framework’s .deps.json
).
Like all the other initialize
functions, this function will
- Process the
.runtimeconfig.json
- Resolve framework references and find actual frameworks
- Find the root framework (
Microsoft.NETCore.App
) and load the hostpolicy from it - The hostpolicy will then process all relevant
.deps.json
files and produce the list of assemblies, native search paths and other artifacts needed to initialize the runtime.
The functions will NOT load the CoreCLR runtime. They just prepare everything to the point where it can be loaded.
Arguments
runtime_config_path
: Path to the.runtimeconfig.json
file to process. Unlike withinitialize_for_dotnet_command_line
, any.deps.json
from the app/component will not be processed by the hosting layers.host_path
: Path to the native host (typically the.exe
). This value is not used for anything by the hosting components. It’s just passed to the CoreCLR as the path to the executable. It can point to a file which is not executable itself, if such file doesn’t exist (for example in COM activation scenarios this points to thecomhost.dll
). This is used by PAL to initialize internal command line structures, process name and so on.
pub fn initialize_for_runtime_config_with_dotnet_root(
&self,
runtime_config_path: impl AsRef<PdCStr>,
dotnet_root: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForRuntimeConfig>, Error>
pub fn initialize_for_runtime_config_with_dotnet_root(
&self,
runtime_config_path: impl AsRef<PdCStr>,
dotnet_root: impl AsRef<PdCStr>
) -> Result<HostfxrContext<'_, InitializedForRuntimeConfig>, Error>
This function loads the specified .runtimeconfig.json
, resolve all frameworks, resolve all the assets from those frameworks and
then prepare runtime initialization where the TPA contains only frameworks.
Note that this case does NOT consume any .deps.json
from the app/component (only processes the framework’s .deps.json
).
Like all the other initialize
functions, this function will
- Process the
.runtimeconfig.json
- Resolve framework references and find actual frameworks
- Find the root framework (
Microsoft.NETCore.App
) and load the hostpolicy from it - The hostpolicy will then process all relevant
.deps.json
files and produce the list of assemblies, native search paths and other artifacts needed to initialize the runtime.
The functions will NOT load the CoreCLR runtime. They just prepare everything to the point where it can be loaded.
Arguments
runtime_config_path
: Path to the.runtimeconfig.json
file to process. Unlike withinitialize_for_dotnet_command_line
, any.deps.json
from the app/component will not be processed by the hosting layers.dotnet_root
: Path to the root of the .NET Core installation in use. This typically points to the install location from which the hostfxr has been loaded. For example on Windows this would typically point toC:\Program Files\dotnet
. The path is used to search for shared frameworks and potentially SDKs.