microsoft / microsoft/aspire

Allow setting of binary contents for `ContainerFile`

Open
#18,466 1 comment 0 reactions 0 assignees View on GitHub
area-app-model triage:bot-seen
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

Currently Container Files can be set in one of two ways - you can point them to an existing file, or you can give them contents to set. However the `Content` only accepts `strings`, meaning.

This is not ideal for binary files. Particularly for things like PFX certificates where you'd rather not write them out to disk if you can avoid it.

DCP does support it - it exposes a `RawContents` property. Which is internally used by DCP for injecting PFX certificates. But as far as I can tell, it's not exposed in the Aspire Hosting api at all.

https://github.com/microsoft/aspire/blob/4e2be04d230aa763358a26335fa0665118f39680/src/Aspire.Hosting/Dcp/Model/Container.cs#L446-L448

### Describe the solution you'd like

Some kind of way to provide a `byte[]` or `Stream` on a `ContainerFile`. (Which ultimately gets passed along to `RawContents`)

### Additional context

cc @danegsta

Contributor guide

Open the contributing guide

Research direction

Start with the linked DCP Container.cs definition around lines 446-448, then trace how ContainerFile content is exposed through the Aspire Hosting API. Check existing hosting tests for ContainerFile behavior; done means binary content can reach DCP's RawContents without requiring a temporary file while existing string content continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design, cloud
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.