Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Blazor] Document how to package a Blazor Web App as a .NET tool #36546

@javiercn

Description

@javiercn

There's no documentation on how to package an ASP.NET Core Blazor Web App (with server interactivity) as a .NET tool that can be installed via dotnet tool install.

This is useful for CLI tools that need a local web UI (configuration dashboards, testing tools, etc).

I've created a complete sample demonstrating the approach:
https://github.com/javiercn/blazor-pack-as-tool-sample

Key concepts covered:

  • Two-project architecture (tool host + Blazor web app)
  • MSBuild targets to publish the web app into the NuGet package
  • Launching the web app as a subprocess with environment variables
  • Parent process monitoring to prevent orphaned web servers

The repo includes a step-by-step tutorial in docs/TUTORIAL.md.

@baronfel you might be interested in looking at this. I'm not sure if it can be simplified with the .NET 10.0 additions.

@danroth27 since we have had people asking for this across different fronts over the years, I want to put it on your radar.

@guardrex wait for @baronfel and @danroth27 input on where to put this in the docs, or if they don't provide input in 30 days, find the appropriate location yourself. This doc is not urgent, just leaving things queued up.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

P2 - Medium Priority

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions