Umbraco.Community.WorktreeDevPort
0.3.0
dotnet add package Umbraco.Community.WorktreeDevPort --version 0.3.0
NuGet\Install-Package Umbraco.Community.WorktreeDevPort -Version 0.3.0
<PackageReference Include="Umbraco.Community.WorktreeDevPort" Version="0.3.0" />
<PackageVersion Include="Umbraco.Community.WorktreeDevPort" Version="0.3.0" />
<PackageReference Include="Umbraco.Community.WorktreeDevPort" />
paket add Umbraco.Community.WorktreeDevPort --version 0.3.0
#r "nuget: Umbraco.Community.WorktreeDevPort, 0.3.0"
#:package Umbraco.Community.WorktreeDevPort@0.3.0
#addin nuget:?package=Umbraco.Community.WorktreeDevPort&version=0.3.0
#tool nuget:?package=Umbraco.Community.WorktreeDevPort&version=0.3.0
Umbraco.Community.WorktreeDevPort
Gives every git worktree of an Umbraco site its own stable local dev port, discoverable by any tool with a plain git config call — no named pipe, no Unix socket, no /site-address endpoint to query.
Install
dotnet add package Umbraco.Community.WorktreeDevPort
That's it — the composer is picked up automatically by Umbraco and only activates when ASPNETCORE_ENVIRONMENT=Development.
How it works
- The first time the site starts in a given worktree, it picks a free port and saves it with
git config --worktree wdp.port <port>. The main checkout gets44355when it's free; every linked worktree gets the first free port from44300up instead, so44355stays reserved. - That value lives in the worktree's own git config (
.git/config.worktreeor.git/worktrees/<name>/config.worktree) — never in a tracked file, never in/tmp. - Every later run in that same worktree reuses the same port.
- Removing the worktree (
git worktree remove) deletes the saved port with it. Nothing to clean up by hand. - Any other tool — a client generator script, an AI agent, a teammate — gets the same port by running
git config --worktree --get wdp.port. No need to ask the running site what port it's on.
See worktree-dev-port for the matching Node.js helper.
Configuration
Optional, in appsettings.Development.json:
{
"WorktreeDevPort": {
"BasePort": 44300,
"RangeSize": 100,
"MainWorktreePort": 44355
}
}
Set MainWorktreePort to null to disable the fixed-port reservation and always use the pool.
If ASPNETCORE_URLS (or urls) is already set to a real fixed port, this package leaves it alone. A :0 port (the old "ask the OS for a random port" trick) is treated the same as no URL being set at all — this package's whole job is to replace that.
License
MIT — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Umbraco.Cms.Web.Common (>= 17.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.