PortExtensionsAspire 134.2026.809.1615
dotnet add package PortExtensionsAspire --version 134.2026.809.1615
NuGet\Install-Package PortExtensionsAspire -Version 134.2026.809.1615
<PackageReference Include="PortExtensionsAspire" Version="134.2026.809.1615" />
<PackageVersion Include="PortExtensionsAspire" Version="134.2026.809.1615" />
<PackageReference Include="PortExtensionsAspire" />
paket add PortExtensionsAspire --version 134.2026.809.1615
#r "nuget: PortExtensionsAspire, 134.2026.809.1615"
#:package PortExtensionsAspire@134.2026.809.1615
#addin nuget:?package=PortExtensionsAspire&version=134.2026.809.1615
#tool nuget:?package=PortExtensionsAspire&version=134.2026.809.1615
PortExtensionsAspire
A .NET Aspire extension that assigns deterministic (repeatable) ports to named resources and exposes them as PORT_{name} environment variables to other resources in your distributed application.
Links
- NuGet Package: https://www.nuget.org/packages/PortExtensionsAspire
- GitHub Repository: https://github.com/ignatandrei/aspireExtensions
Features
- Computes a deterministic port for a given name (and optional tag) so the same name always maps to the same port across runs
- Registers the computed ports on a dedicated
PortResourceso they are visible in the Aspire dashboard as environment variables - Injects the registered ports (
PORT_{name}) into any other resource viaWithPortReference
Requirements
- .NET 10.0 or later
- Aspire 13.0 or later
Installation
Install via NuGet:
dotnet add package PortExtensionsAspire
Usage
var builder = DistributedApplication.CreateBuilder(args);
var ports = builder.AddPort()
.WithDeterministicPortEnvironment("sqliteweb", "mongodb")
.Construct();
builder.AddSqlite("sqlite")
.WithSqliteWeb(c =>
{
c.WithHttpEndpoint(targetPort: 8080, name: "http", port: ports.Resource.GetDeterministicPort("sqliteweb"));
});
builder.AddProject<Projects.ShowPort>("ShowPort")
.WithPortReference(ports);
builder.Build().Run();
⚠️ Warning: ports are not guaranteed to be unique
GetDeterministicPort derives a port by hashing the given name (optionally combined with a tag) and reducing it into the UInt16 range. This makes the port repeatable across runs for the same name, but it does not guarantee uniqueness across different names: two different names can hash to the same port (a hash collision), which would result in two resources being assigned the same port. If you hit a collision, pick a different name/tag combination for one of the resources, or manually override the port.
Contributing
Contributions are welcome! Please open issues or submit pull requests via GitHub.
License
This project is licensed under the MIT License.
Links
| 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
- CommunityToolkit.Aspire.Hosting.Sqlite (>= 13.4.0)
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 |
|---|---|---|
| 134.2026.809.1615 | 91 | 8/9/2026 |