Currently the IServiceMetadata implementations that are created within the Projects namespace are discovered and compiled using the following MSBuild target:
I'm proposing that you consider creating and using a Roslyn Analyzer (Source generator) instead. When I first explored this generated IServiceMetadata implementation I was surprised to see that I could edit the file, which wouldn't be the case with a source generated file.
Additionally, I would like to propose that instead of replacing . and - with _, that you simply remove them instead. For example, consider the following differences in these two approaches:
AspireSample.Web would be AspireSampleWeb instead of AspireSample_Web.
AspireSample.ApiService would be AspireSampleApiService instead of AspireSample_ApiService.
Currently the
IServiceMetadata
implementations that are created within theProjects
namespace are discovered and compiled using the following MSBuild target:https://github.com/dotnet/aspire/blob/12af412b50c7533a75748edae2776d70a64c890e/src/Aspire.Hosting/build/Aspire.Hosting.targets#L15-L64
I'm proposing that you consider creating and using a Roslyn Analyzer (Source generator) instead. When I first explored this generated
IServiceMetadata
implementation I was surprised to see that I could edit the file, which wouldn't be the case with a source generated file.Additionally, I would like to propose that instead of replacing
.
and-
with_
, that you simply remove them instead. For example, consider the following differences in these two approaches:AspireSample.Web
would beAspireSampleWeb
instead ofAspireSample_Web
.AspireSample.ApiService
would beAspireSampleApiService
instead ofAspireSample_ApiService
.This feels a bit more idiomatic.