Skip to content

Add build error when GenerateAssemblyInfo is disabled in AppHost projects#13751

Merged
DamianEdwards merged 3 commits intomainfrom
copilot/update-msbuild-targets-for-assemblyinfo
Jan 5, 2026
Merged

Add build error when GenerateAssemblyInfo is disabled in AppHost projects#13751
DamianEdwards merged 3 commits intomainfrom
copilot/update-msbuild-targets-for-assemblyinfo

Conversation

Copy link
Contributor

Copilot AI commented Jan 5, 2026

Description

AppHost projects rely on AssemblyMetadataAttribute to embed DCP and Dashboard paths during compilation. When GenerateAssemblyInfo is disabled, these attributes are not generated, causing cryptic runtime failures about missing orchestration dependencies. This change detects the misconfiguration at build time with a clear, actionable error.

Changes:

  • MSBuild validation: Added __ErrorOnGenerateAssemblyInfoDisabled target in Aspire.Hosting.AppHost.in.targets that emits ASPIRE008 error when GenerateAssemblyInfo is false
  • Diagnostics documentation: Added ASPIRE008 to the MSBuild errors table
  • Test coverage: Added GenerateAssemblyInfoFalse_EmitsError test to verify error emission

Error message:

error ASPIRE008: [ProjectName] project requires GenerateAssemblyInfo to be enabled. 
The Aspire AppHost relies on assembly metadata attributes to locate required dependencies. 
Please remove <GenerateAssemblyInfo>false</GenerateAssemblyInfo> from your project file or set it to true.

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?
    • Yes
      • Link to aspire-docs issue (consider using one of the following templates):
    • No
Original prompt

This section details on the original issue you should resolve

<issue_title>GenerateAssemblyInfo must be true else "Property CliPath: The path to the DCP executable used for Aspire orchestration is required"</issue_title>
<issue_description>When I try to run any of the samples, I get this error:
System.AggregateException: One or more errors occurred. (Property CliPath: The path to the DCP executable used for Aspire orchestration is required.; Property DashboardPath: The path to the Aspire Dashboard binaries is missing.)

I have installed the Aspire workload. I'm on ArchLinux with dotnet-sdk 108.

Interestingly, creating a sample with dotnet new aspire-starter --use-redis-cache --output AspireSample and running it with dotnet-run does work.</issue_description>

<agent_instructions>We want to update the MSBuild targets brought in by the Aspire.Hosting.AppHost package so that if the GenerateAssemblyInfo property is set to false a build error is produced, indicating that it must be enabled for the AppHost project to function correctly.</agent_instructions>

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

@DamianEdwards @karelz @joperezr @danegsta any idea on this one? @joperezr @to-mas-kral sorry for not seeing this sooner, and than you for logging the issue. Since this is an older issue, I believe it could just be a dupe of https://github.com//issues/5674 which has already been fixed. Can you make sure that you are on the latest version of the workload by running `dotnet workload update` to get a version that has the fix? @davidfowl No there’s no workaround. Enable it in the apphost project @DamianEdwards Let's just update our targets to log a build error if `GenerateAssemblyInfo` is disabled.

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

@github-actions
Copy link
Contributor

github-actions bot commented Jan 5, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13751

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13751"

Copilot AI and others added 2 commits January 5, 2026 21:00
Co-authored-by: DamianEdwards <249088+DamianEdwards@users.noreply.github.com>
Co-authored-by: DamianEdwards <249088+DamianEdwards@users.noreply.github.com>
Copilot AI changed the title [WIP] Update MSBuild targets for GenerateAssemblyInfo validation Add build error when GenerateAssemblyInfo is disabled in AppHost projects Jan 5, 2026
Copilot AI requested a review from DamianEdwards January 5, 2026 21:08
@DamianEdwards DamianEdwards marked this pull request as ready for review January 5, 2026 21:09
Copilot AI review requested due to automatic review settings January 5, 2026 21:09
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 build-time validation to detect and prevent a misconfiguration in Aspire AppHost projects where GenerateAssemblyInfo is disabled, which causes cryptic runtime failures. When this setting is false, assembly metadata attributes that embed DCP and Dashboard paths are not generated, breaking the orchestration infrastructure.

Key Changes:

  • Added MSBuild target that fails the build with ASPIRE008 error when GenerateAssemblyInfo is false in AppHost projects
  • Created comprehensive test to verify the validation triggers correctly
  • Documented the new ASPIRE008 diagnostic in the diagnostics reference

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Aspire.Hosting.AppHost/build/Aspire.Hosting.AppHost.in.targets Added __ErrorOnGenerateAssemblyInfoDisabled target that emits ASPIRE008 error when GenerateAssemblyInfo is false in AppHost projects
tests/Aspire.Hosting.Tests/MSBuildTests.cs Added GenerateAssemblyInfoFalse_EmitsError test that verifies build fails with ASPIRE008 when GenerateAssemblyInfo is disabled
docs/list-of-diagnostics.md Added ASPIRE008 entry to MSBuild errors table with clear description and location reference

@DamianEdwards
Copy link
Member

Results from running locally on apphosts with GenerateAssemblyInfo set to false via a Directory.Build.props:

On Blazor starter:

➜ aspire run
🔍 Finding apphosts...
BlazorStarter.AppHost\BlazorStarter.AppHost.csproj

🗄  Created settings file at '.aspire/settings.json'.
  Determining projects to restore...
  All projects are up-to-date for restore.
D:\scratch\aspire\pr-13751\BlazorStarter\BlazorStarter.AppHost\BlazorStarter.AppHost.csproj : error ASPIRE008: BlazorStarter.AppHost
project requires GenerateAssemblyInfo to be enabled. The Aspire AppHost relies on assembly metadata attributes to locate required
dependencies. Please remove <GenerateAssemblyInfo>false</GenerateAssemblyInfo> from your project file or set it to true.

Build FAILED.

D:\scratch\aspire\pr-13751\BlazorStarter\BlazorStarter.AppHost\BlazorStarter.AppHost.csproj : error ASPIRE008: BlazorStarter.AppHost
project requires GenerateAssemblyInfo to be enabled. The Aspire AppHost relies on assembly metadata attributes to locate required
dependencies. Please remove <GenerateAssemblyInfo>false</GenerateAssemblyInfo> from your project file or set it to true.
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.88
❌ The project could not be built. For more information run with --debug switch.

On Python starter:

aspire run
🔍 Finding apphosts...
apphost.cs

🗄  Created settings file at '.aspire/settings.json'.
❌ An error occurred while connecting to the app host. The app host possibly crashed before it was available: AppHost process has exited
unexpectedly. Use --debug to see more details..
Using launch settings from D:\scratch\aspire\pr-13751\PythonStarter\apphost.run.json...
Building...
D:\scratch\aspire\pr-13751\PythonStarter\apphost.csproj : error ASPIRE008: apphost project requires GenerateAssemblyInfo to be
enabled. The Aspire AppHost relies on assembly metadata attributes to locate required dependencies. Please remove
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> from your project file or set it to true.

The build failed. Fix the build errors and run again.

| `ASPIRE004` | Warning | '\[ProjectName\]' is referenced by an Aspire Host project, but it is not an executable. Did you mean to set IsAspireProjectResource=&quot;false&quot;? | [src/Aspire.Hosting.AppHost/build/Aspire.Hosting.AppHost.in.targets](../src/Aspire.Hosting.AppHost/build/Aspire.Hosting.AppHost.in.targets) |
| `ASPIRE005` | Error | (Deprecated) This diagnostic is no longer used. | |
| `ASPIRE007` | Error | '\[ProjectName\]' project requires a reference to &quot;Aspire.AppHost.Sdk&quot; with version &quot;9.0.0&quot; or greater to work correctly. Please add the following line after the Project declaration `<Sdk Name=Aspire.AppHost.Sdk" Version="9.0.0" />`. | [src/Aspire.Hosting.AppHost/build/Aspire.Hosting.AppHost.in.targets](../src/Aspire.Hosting.AppHost/build/Aspire.Hosting.AppHost.in.targets) |
| `ASPIRE008` | Error | '\[ProjectName\]' project requires GenerateAssemblyInfo to be enabled. The Aspire AppHost relies on assembly metadata attributes to locate required dependencies. Please remove &lt;GenerateAssemblyInfo&gt;false&lt;/GenerateAssemblyInfo&gt; from your project file or set it to true. | [src/Aspire.Hosting.AppHost/build/Aspire.Hosting.AppHost.in.targets](../src/Aspire.Hosting.AppHost/build/Aspire.Hosting.AppHost.in.targets) |
Copy link
Member

Choose a reason for hiding this comment

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

We will need to add this to the official docs and will also need to add an aka.ms link for it I think.

Copy link
Member

Choose a reason for hiding this comment

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

Hmmm I wonder if we should consider changing the aka.ms stuff to flow this as a query parameter instead so each diagnostic doesn't need its own entry?

Copy link
Member

Choose a reason for hiding this comment

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

Created regular aka.ms link for now and logged dotnet/docs-aspire#6093

@DamianEdwards DamianEdwards merged commit c7ef62f into main Jan 5, 2026
567 of 571 checks passed
@DamianEdwards DamianEdwards deleted the copilot/update-msbuild-targets-for-assemblyinfo branch January 5, 2026 23:52
@dotnet-policy-service dotnet-policy-service bot added this to the 13.2 milestone Jan 5, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GenerateAssemblyInfo must be true else "Property CliPath: The path to the DCP executable used for Aspire orchestration is required"

4 participants