Skip to content

fix ef migration with publish in run mode - #17207

Merged
Sébastien Ros (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
Sébastien Ros (sebastienros) merged 2 commits into
microsoft:mainfrom
Waleed-KH:ef-migration-patch

Conversation

@Waleed-KH

@Waleed-KH Waleed Khaled (Waleed-KH) commented May 18, 2026

Copy link
Copy Markdown
Contributor

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

github-actions Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

🚀 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

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
Sébastien Ros (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
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 19, 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.

4 participants