Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 3, 2025

The nethost and hostfxr hosting APIs don't support self-contained deployments, but this limitation wasn't documented.

Changes

  • Added IMPORTANT note under "Hosting APIs" section clarifying that these APIs only work with framework-dependent deployments
  • Clarified that self-contained deployments are only supported with built-in hosts
  • Provided actionable guidance for developers evaluating deployment models

The note appears immediately after the introductory paragraph in the "Hosting APIs" section, ensuring readers understand this constraint before implementing a custom host.

This pull request was created as a result of the following prompt from Copilot chat.

Add a clarification in docs/core/tutorials/netcore-hosting.md stating that the hosting APIs (nethost and hostfxr) are only supported for framework-dependent applications and cannot be used for single-file deployments. Preferably add this note under the "Hosting APIs" section. Include guidance that if users choose the single-file publishing deployment model, these native hosting APIs will not work as expected, and a framework-dependent deployment is required.

Be clear and actionable for readers evaluating their deployment models, and reference the relevant terms (framework-dependent, single-file).

Original prompt

Add a clarification in docs/core/tutorials/netcore-hosting.md stating that the hosting APIs (nethost and hostfxr) are only supported for framework-dependent applications and cannot be used for single-file deployments. Preferably add this note under the "Hosting APIs" section. Include guidance that if users choose the single-file publishing deployment model, these native hosting APIs will not work as expected, and a framework-dependent deployment is required.

Be clear and actionable for readers evaluating their deployment models, and reference the relevant terms (framework-dependent, single-file).

This pull request was created as a result of the following prompt from Copilot chat.

Add a clarification in docs/core/tutorials/netcore-hosting.md stating that the hosting APIs (nethost and hostfxr) are only supported for framework-dependent applications and cannot be used for single-file deployments. Preferably add this note under the "Hosting APIs" section. Include guidance that if users choose the single-file publishing deployment model, these native hosting APIs will not work as expected, and a framework-dependent deployment is required.

Be clear and actionable for readers evaluating their deployment models, and reference the relevant terms (framework-dependent, single-file).


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


Internal previews

📄 File 🔗 Preview link
docs/core/tutorials/netcore-hosting.md Write a custom .NET host to control the .NET runtime from your native code

…oyments

Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Copilot AI changed the title [WIP] Add clarification on hosting APIs usage in netcore-hosting docs Add clarification that hosting APIs require framework-dependent deployments Nov 3, 2025
Copilot finished work on behalf of agocke November 3, 2025 20:06
Copilot AI requested a review from agocke November 3, 2025 20:06
Hosting the .NET runtime is done with the `nethost` and `hostfxr` libraries' APIs. These entry points handle the complexity of finding and setting up the runtime for initialization and allow both launching a managed application and calling into a static managed method.

> [!IMPORTANT]
> The `nethost` and `hostfxr` hosting APIs only support framework-dependent deployments. These APIs don't work with single-file deployments because the required runtime files must be available separately on the target system. If you're evaluating deployment models for your application, use a framework-dependent deployment to ensure compatibility with these native hosting APIs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> The `nethost` and `hostfxr` hosting APIs only support framework-dependent deployments. These APIs don't work with single-file deployments because the required runtime files must be available separately on the target system. If you're evaluating deployment models for your application, use a framework-dependent deployment to ensure compatibility with these native hosting APIs.
> The `nethost` and `hostfxr` hosting APIs only support framework-dependent deployments. Self-contained deployments are only supported with the built-in hosts. If you're evaluating deployment models for your application, use a framework-dependent deployment to ensure compatibility with these native hosting APIs.

@copilot please fix

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the note to clarify that self-contained deployments are only supported with built-in hosts. Commit: 9c857e6

Co-authored-by: agocke <515774+agocke@users.noreply.github.com>
Copilot finished work on behalf of agocke November 3, 2025 21:56
Copilot AI requested a review from agocke November 3, 2025 21:56
Clarify deployment model information for nethost and hostfxr APIs.
@agocke agocke marked this pull request as ready for review November 4, 2025 21:14
@agocke agocke requested a review from meaghanlewis as a code owner November 4, 2025 21:14
Copilot AI review requested due to automatic review settings November 4, 2025 21:14
@agocke agocke requested a review from a team as a code owner November 4, 2025 21:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds an important note to clarify that the nethost and hostfxr hosting APIs only support framework-dependent deployments and don't work with self-contained deployments.

Key Changes

  • Added an IMPORTANT callout box explaining hosting API deployment model limitations.
  • Provided guidance to use framework-dependent deployments for compatibility with native hosting APIs.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants