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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Umbraco.Community.WorktreeDevPort" Version="0.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Umbraco.Community.WorktreeDevPort" Version="0.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Umbraco.Community.WorktreeDevPort" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Umbraco.Community.WorktreeDevPort --version 0.3.0
                    
#r "nuget: Umbraco.Community.WorktreeDevPort, 0.3.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Umbraco.Community.WorktreeDevPort@0.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Umbraco.Community.WorktreeDevPort&version=0.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Umbraco.Community.WorktreeDevPort&version=0.3.0
                    
Install as a Cake Tool

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 gets 44355 when it's free; every linked worktree gets the first free port from 44300 up instead, so 44355 stays reserved.
  • That value lives in the worktree's own git config (.git/config.worktree or .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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.3.0 369 9/18/2026
0.2.0 69 9/18/2026
0.1.2 75 9/18/2026