dotnet / dotnet/sdk

Getting container metadata from another project

Open
#49,903 1 comment 0 reactions 0 assignees View on GitHub
Area-Containers
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Is your feature request related to a problem? Please describe.
It would be helpful if you could get container build information from for one project from another project:

For CLI based apps, you can get this information out via `-getproperty` and `-getitem` but there's no way to do this within a larger msbuild project.

### Describe the solution you'd like

A target that can output the following information in a way that can be read in another project

- Whether the project is enabled for SDK container builds
- Container Registry
- Container Repository
- Container Tags
- Container Ports (including derivations from `ASPNETCORE_URLS`, `ASPNETCORE_HTTP_PORTS` & `ASPNETCORE_HTTPS_PORTS`

### Additional context

For context of what I'm looking for - I'm trying to capture container metadata from an application in a library that can reference that project's container as a custom Aspire Hosting Integration, using a similar pattern to Aspire's `IProjectMetadata` implementation:

https://github.com/afscrome/AspireProjectAsContainerNugetIntegration/blob/eea83ae7270d5f55425a4a448c4d7d0570e09363/SdkContainerPackage.Aspire.Hosting.ApiService/sdk/Sdk.targets#L38-L49
https://github.com/afscrome/AspireProjectAsContainerNugetIntegration/blob/eea83ae7270d5f55425a4a448c4d7d0570e09363/Directory.Build.targets#L3-L12

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.