aspire deploy overwrites `ContainerRuntimeIdentifier`
- 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
### Describe the bug
If a project in an Aspire solution requires non-standard `ContainerRuntimeIdentifier`, it is not possible to build a container with this project as Aspire overwrites the property with the default one.
### Expected Behavior
Overrides within the project file are respected. `aspire deploy` succeeds the build.
### Steps To Reproduce
https://github.com/Lexy2/aspire-cri-override
1. Clone the project.
2. Run `aspire deploy`
### Exceptions (if any)
```
[DBG] Starting .NET CLI with arguments: publish "D:\src\repos\aspire-cri-override\aspire-cri-override.App\aspire-cri-override.App.csproj" --configuration Release /t:PublishContainer
/p:ContainerRepository="console" /p:ContainerImageTag="latest" /p:LocalRegistry="Docker" /p:ContainerArchiveOutputPath="." /p:ContainerImageFormat="OCI" /p:RuntimeIdentifier="win-x64" /p:ContainerRuntimeIdentifier="win-x64"
...
C:\Program Files\dotnet\sdk\10.0.300\Containers\build\Microsoft.NET.Build.Containers.targets(261,5): error : BaseImageNotFoundException: The RuntimeIdentifier 'win-x64' is not supported by
windows/nanoserver:ltsc2022. The supported RuntimeIdentifiers are win10-x64 [D:\src\repos\aspire-cri-override\aspire-cri-override.App\aspire-cri-override.App.csproj]
```
### Aspire doctor output
```
Aspire Environment Check
========================
Aspire
✅ Aspire CLI version 13.4.3 (channel: stable)
AppHost
✅ AppHost version 13.4.3 (aspire-cri-override.AppHost\aspire-cri-override.AppHost.csproj)
.NET SDK
✅ .NET 10.0.300 installed (x64)
Container Runtime
⚠️ Docker client version 27.4.1 is below minimum required 28.0.0 ← active
Upgrade Docker to version 28.0.0 or later from: https://www.docker.com/products/docker-desktop
See: https://aka.ms/aspire/containers
Environment
✅ HTTPS development certificate is trusted
Summary: 4 passed, 1 warnings, 0 failed
For detailed prerequisites: https://aka.ms/aspire-prerequisites
Aspire CLI Installations
========================
╭─────────────────────────────────────────────────────────┬─────────────────────────────────────────────────┬─────────┬───────────┬─────────────╮
│ Path │ Version │ Channel │ Route │ PATH status │
├─────────────────────────────────────────────────────────┼─────────────────────────────────────────────────┼─────────┼───────────┼─────────────┤
│ C:\Users\lexy.zhitenev\.aspire\bin\aspire.exe (current) │ 13.4.3+4f218933552e18ff2874d1b6d5dc3fe671e3b6d9 │ stable │ (unknown) │ active │
╰─────────────────────────────────────────────────────────┴─────────────────────────────────────────────────┴─────────┴───────────┴─────────────╯
```
### Anything else?
The main thing in the repro is that the `ContainerBaseImage` in the project file has to be set to something that doesn't support the standard constant of the runtime - e.g. `win10-x64` instead of just `win-x64`.
Omitting the configuration item in Aspire's `ContainerBuildOptions` doesn't work either as it defaults and overwrites the property to `linux-x64`.
There is a related discussion in #10000, but not quite that.
Contributor guide
Assessment
This issue has not been assessed yet.