Skip to content

fix ef migration with publish in run mode#17207

Merged
sebastienros merged 2 commits into
microsoft:mainfrom
Waleed-KH:ef-migration-patch
May 19, 2026
Merged

fix ef migration with publish in run mode#17207
sebastienros merged 2 commits into
microsoft:mainfrom
Waleed-KH:ef-migration-patch

Conversation

@Waleed-KH
Copy link
Copy Markdown
Contributor

@Waleed-KH Waleed-KH commented May 18, 2026

Description

When adding EF Migrations resource with publish step, it breaks the run mode.

var efMigration = webService.AddEFMigrations("ef-migration")
	.WithMigrationsProject<Projects.Data>()
	.WithReference(mainDatabase)
	.WaitFor(mainDatabase)
	.RunDatabaseUpdateOnStart()
	.PublishAsMigrationBundle(publishContainer: true);
Unhandled exception. System.AggregateException: One or more errors occurred. (Step 'ef-migration-generate-migration-bundle' is required by unknown step 'build-ef-migration')
 ---> System.InvalidOperationException: Step 'ef-migration-generate-migration-bundle' is required by unknown step 'build-ef-migration'
   at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.ValidateSteps(IEnumerable`1 steps) in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 836
   at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.ResolveStepsAsync(PipelineContext context) in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 640
   at Aspire.Hosting.Pipelines.DistributedApplicationPipeline.ExecuteStepSequentiallyAsync(String stepName, PipelineContext context) in /_/src/Aspire.Hosting/Pipelines/DistributedApplicationPipeline.cs:line 599
   at Aspire.Hosting.DistributedApplication.ExecuteBeforeStartHooksAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/DistributedApplication.cs:line 610
   at Aspire.Hosting.DistributedApplication.RunAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/DistributedApplication.cs:line 505
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Aspire.Hosting.DistributedApplication.Run() in /_/src/Aspire.Hosting/DistributedApplication.cs:line 544
   at Program.<Main>$(String[] args) in D:\Workspace\Projects\MyApp\AppHost\Program.cs:line 3

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

Copilot AI review requested due to automatic review settings May 18, 2026 13:51
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 18, 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/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17207

Or

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

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

@AndriySvyryd AndriySvyryd left a comment

Choose a reason for hiding this comment

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

Looks good.
Though I had already fixed this in #16966

@sebastienros sebastienros merged commit ca8d55c into microsoft:main May 19, 2026
297 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 13.4 milestone May 19, 2026
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.

4 participants