Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

Documentation update for AspireProjectMetadataTypeName attribute

  • Understand the issue requirements and analyze existing documentation structure
  • Research AspireProjectMetadataTypeName attribute functionality
  • Update aspire-sdk.mdx to add documentation about AspireProjectMetadataTypeName
  • Format the documentation with prettier
  • Revert unintended formatting changes to other files
  • Add missing blank line before section header for proper formatting
  • Review changes and ensure consistency with existing documentation style

Summary of Changes

Added a new subsection "Customizing generated project names" under the "Project references" section in aspire-sdk.mdx that documents the AspireProjectMetadataTypeName attribute.

The documentation explains:

  • How the attribute allows customization of generated project names in the Projects namespace
  • When to use it (multiple projects with the same name)
  • A practical example showing how to differentiate two projects with identical names
  • Code examples showing both the XML configuration and C# usage

Updates:

  • Reverted formatting changes to other files that were unintentionally included
  • Added blank line before "Orchestrator dependencies" section for proper formatting
Original prompt

This section details on the original issue you should resolve

<issue_title>Add a tips page about project names and constants</issue_title>
<issue_description>Basically a page describing this https://youtu.be/Jt39GzYCRgo

  • The "Shared" constants library

  • The IsAspireProjectResource attribute

Image
  • The AspireProjectMetadataTypeName attribute
Image

</issue_description>

<agent_instructions>Please update the aspire-sdk.mdx article to include details about the AspireProjectMetadataTypeName. Some of it's details are here https://learn.microsoft.com/en-us/dotnet/api/aspire.hosting.projectresourcebuilderextensions.addproject?view=dotnet-aspire-13.0. This attribute is applied to a ProjectReference element to override the generated name.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@IEvangelist I did watch these videos and looked through the tips, one thing to callout is that they're specific to .NET projects, so they wouldn't be helpful in Python or TypeScript/JavaScript ecosystems (For example, you cannot create a shared library that can be consumed by the AppHost). I will work on adding details about the `AspireProjectMetadataTypeName` attribute as that is valuable and currently missing.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
@IEvangelist
Copy link
Member

Hey @copilot, please undo all formatting changes to the other files - only update the sdk article like requested.

Copilot AI changed the title [WIP] Add tips page about project names and constants Document AspireProjectMetadataTypeName attribute for resolving project name conflicts Jan 5, 2026
Copilot AI requested a review from IEvangelist January 5, 2026 16:07
…pdate

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 5, 2026

Hey @copilot, please undo all formatting changes to the other files - only update the sdk article like requested.

Reverted formatting changes to all other files. Only aspire-sdk.mdx is updated now. (commit a0b67d1)

@IEvangelist IEvangelist marked this pull request as ready for review January 5, 2026 16:29
Copilot AI review requested due to automatic review settings January 5, 2026 16:29
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds documentation for the AspireProjectMetadataTypeName attribute, which allows developers to customize generated project names in the Aspire SDK's Projects namespace. This addresses a gap in the documentation for handling scenarios where multiple projects have the same name.

Key Changes

  • Documents the AspireProjectMetadataTypeName attribute and its purpose for resolving project name conflicts
  • Provides a practical example showing how to differentiate two projects with identical names using custom type names
  • Includes both XML configuration and C# usage examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@IEvangelist
Copy link
Member

Hey @copilot, please take a screenshot of the page, but before you do - please reject all cookies by clicking the Reject all button:

#cc-main > div > div > div.cm__body > div.cm__btns > div:nth-child(1) > button.cm__btn.cm__btn--secondary

Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 5, 2026

Hey @copilot, please take a screenshot of the page, but before you do - please reject all cookies by clicking the Reject all button:

`#cc-main > div > div > div.cm__body > div.cm__btns > div:nth-ch...

Screenshot of the updated page showing the "Customizing generated project names" section:

aspire-sdk-page

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/CommunityToolkit/Aspire
    • Triggering command: /usr/local/bin/node node ./scripts/update-github-stats.js (http block)
  • https://api.github.com/repos/dotnet/aspire
    • Triggering command: /usr/local/bin/node node ./scripts/update-github-stats.js (http block)
  • https://api.github.com/repos/dotnet/aspire-samples
    • Triggering command: /usr/local/bin/node node ./scripts/update-github-stats.js (http block)
  • https://api.github.com/repos/microsoft/aspire.dev
    • Triggering command: /usr/local/bin/node node ./scripts/update-github-stats.js (http block)
  • telemetry.astro.build
    • Triggering command: /usr/local/bin/node node /home/REDACTED/work/aspire.dev/aspire.dev/src/frontend/node_modules/.bin/../astro/astro.js dev (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


When you reference a project in the AppHost, the Aspire SDK generates a strongly-typed class in the `Projects` namespace. By default, the generated class name is based on the project's name. However, if you have multiple projects with the same name or want to customize the generated type name, you can use the `AspireProjectMetadataTypeName` attribute.

For example, if you have two microservices with the same project name (like `Presentation.Api`), you can differentiate them by setting custom names:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For example, if you have two microservices with the same project name (like `Presentation.Api`), you can differentiate them by setting custom names:
For example, if you have two services with the same project name (like `Presentation.Api`), you can differentiate them by setting custom names:

Comment on lines +76 to +79
<ProjectReference Include="..\Microservice1\Presentation.Api\Presentation.Api.csproj"
AspireProjectMetadataTypeName="MicroService1" />
<ProjectReference Include="..\Microservice2\Presentation.Api\Presentation.Api.csproj"
AspireProjectMetadataTypeName="MicroService2" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<ProjectReference Include="..\Microservice1\Presentation.Api\Presentation.Api.csproj"
AspireProjectMetadataTypeName="MicroService1" />
<ProjectReference Include="..\Microservice2\Presentation.Api\Presentation.Api.csproj"
AspireProjectMetadataTypeName="MicroService2" />
<ProjectReference Include="..\Service1\Presentation.Api\Presentation.Api.csproj"
AspireProjectMetadataTypeName="Service1" />
<ProjectReference Include="..\Service2\Presentation.Api\Presentation.Api.csproj"
AspireProjectMetadataTypeName="Service2" />

</ItemGroup>
```

This generates `Projects.MicroService1` and `Projects.MicroService2` classes, allowing you to reference each project distinctly in your AppHost:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This generates `Projects.MicroService1` and `Projects.MicroService2` classes, allowing you to reference each project distinctly in your AppHost:
This generates `Projects.Service1` and `Projects.Service2` classes, allowing you to reference each project distinctly in your AppHost:

Comment on lines +86 to +87
var microservice1 = builder.AddProject<Projects.MicroService1>("micro1");
var microservice2 = builder.AddProject<Projects.MicroService2>("micro2");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var microservice1 = builder.AddProject<Projects.MicroService1>("micro1");
var microservice2 = builder.AddProject<Projects.MicroService2>("micro2");
var microservice1 = builder.AddProject<Projects.Service1>("service1");
var microservice2 = builder.AddProject<Projects.Service2>("service2");

@IEvangelist IEvangelist merged commit 61f330b into main Jan 7, 2026
6 checks passed
@IEvangelist IEvangelist deleted the copilot/add-tips-page-for-names-constants branch January 7, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a tips page about project names and constants

3 participants