KoalaSoft.Aspire.Hosting.ServiceSources
0.1.0
See the version list below for details.
dotnet add package KoalaSoft.Aspire.Hosting.ServiceSources --version 0.1.0
NuGet\Install-Package KoalaSoft.Aspire.Hosting.ServiceSources -Version 0.1.0
<PackageReference Include="KoalaSoft.Aspire.Hosting.ServiceSources" Version="0.1.0" />
<PackageVersion Include="KoalaSoft.Aspire.Hosting.ServiceSources" Version="0.1.0" />
<PackageReference Include="KoalaSoft.Aspire.Hosting.ServiceSources" />
paket add KoalaSoft.Aspire.Hosting.ServiceSources --version 0.1.0
#r "nuget: KoalaSoft.Aspire.Hosting.ServiceSources, 0.1.0"
#:package KoalaSoft.Aspire.Hosting.ServiceSources@0.1.0
#addin nuget:?package=KoalaSoft.Aspire.Hosting.ServiceSources&version=0.1.0
#tool nuget:?package=KoalaSoft.Aspire.Hosting.ServiceSources&version=0.1.0
Aspire.Hosting.ServiceSources
A .NET Aspire AppHost extension that lets builder.AddService("orders") resolve to a real,
running resource whose source is chosen per developer, not baked into the AppHost.
Why
AddProject<T>() assumes a service lives in the AppHost's own solution. In a real
microservice environment, services live in separate repositories, and different developers
want different things for the same service: clone it locally to edit, run it from an
already-checked-out working copy, or just reach an instance already running in a shared
Kubernetes dev cluster. The AppHost should only describe what it depends on; where that
dependency actually comes from is a per-developer choice, made without ever touching the
AppHost's .csproj/.sln.
AddService() is the seam: the AppHost calls it once per service, and a developer-local
config file decides how it's actually resolved — today via a managed or self-managed local
git checkout ("local" source) or a kubectl port-forward against a dev cluster
("kubernetes" source) — behind one stable return type, so the AppHost code never has to
change when a developer switches sources.
Install
Published on nuget.org as KoalaSoft.Aspire.Hosting.ServiceSources:
dotnet add package KoalaSoft.Aspire.Hosting.ServiceSources
Or reference the project directly from your AppHost instead:
<ItemGroup>
<ProjectReference Include="path/to/Aspire.Hosting.ServiceSources/Aspire.Hosting.ServiceSources.csproj" />
</ItemGroup>
Requires .NET 10 and an AppHost project using the Aspire.AppHost.Sdk (aspire new /
aspire restore sets this up).
Getting started
1. Declare the service in Program.cs:
using Aspire.Hosting.ServiceSources;
var builder = DistributedApplication.CreateBuilder(args);
var orders = builder.AddService("orders");
var api = builder.AddProject<Projects.Api>("api")
.WithReference(orders);
builder.Build().Run();
2. Add the shared catalog, servicesources.yaml, next to the AppHost project (commit this
file):
services:
orders:
repository: https://github.com/example/orders
project: src/Orders.Api/Orders.Api.csproj
defaultRef: main # optional; branch, tag, or commit SHA
3. Add your own servicesources.local.json next to it (gitignore this file — it's
per-developer):
{
"services": {
"orders": { "source": "local" }
}
}
That's it — running the AppHost now clones orders into
<AppHostDirectory>/.servicesources/checkouts/orders/, checks out main, and runs it via
Aspire's own project orchestration, wired up to api through service discovery exactly like
a project reference would be.
"local" source options
{
"services": {
"orders": { "source": "local" },
"payments": {
"source": "local",
"path": "/home/dev/code/payments",
"ref": "feature/new-checkout"
}
}
}
- Omit
pathfor a managed checkout: cloned once into<AppHostDirectory>/.servicesources/checkouts/<serviceName>/, and reconciled to the configuredref(or the catalog'sdefaultRef) on every run. Uncommitted edits are never discarded — if the checkout is dirty and the ref changed, resolution fails loudly instead of overwriting your work. - Set
pathto point at a checkout you manage yourself (e.g. an existing local clone). It's used as-is — no clone, no checkout, no fetch, ever.refcannot be combined withpath.
"kubernetes" source
Point a service at an already-running instance in a Kubernetes dev cluster via
kubectl port-forward, instead of running it locally at all.
servicesources.yaml:
services:
orders:
kubernetes:
service: orders-svc
port: 8080
servicesources.local.json:
{
"services": {
"orders": {
"source": "kubernetes",
"context": "dev-west",
"namespace": "orders",
"port": 8080
}
}
}
Requires kubectl on PATH, authenticated against the named context.
Sample
samples/DemoAppHost is a minimal working AppHost wired up against samples/SampleService
via the "local" source with path — run it to see the whole flow end to end:
cd samples/DemoAppHost
cp servicesources.local.json.example servicesources.local.json
aspire run
Status
Early stage, evolving fast. "local", "kubernetes", "url", and "container" sources are
all implemented — see docs/superpowers/ for design and implementation
history, including the phase 2 backlog (repo auto-update, config discovery walk-up,
dependency/infrastructure resolution, and more).
| 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
- Aspire.Hosting (>= 13.4.6)
- LibGit2Sharp (>= 0.32.0)
- YamlDotNet (>= 18.1.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on KoalaSoft.Aspire.Hosting.ServiceSources:
| Package | Downloads |
|---|---|
|
KoalaSoft.Aspire.Hosting.ServiceSources.JavaScript
JavaScript support for KoalaSoft.Aspire.Hosting.ServiceSources — runs a "local"-sourced service with kind "javascript" through Aspire.Hosting.JavaScript. |
|
|
KoalaSoft.Aspire.Hosting.ServiceSources.Java
Java support for KoalaSoft.Aspire.Hosting.ServiceSources — lets an AddService() "local" source clone and run a Java service (Maven goal, Gradle task, or a jar) via the .NET Aspire Community Toolkit's Java integration. |
GitHub repositories
This package is not used by any popular GitHub repositories.