Skip to content

Allow custom build configurations in MigrationsBundleCommand#38206

Merged
AndriySvyryd merged 1 commit into
dotnet:mainfrom
m-x-shokhzod:fix/migrations-bundle-custom-config
May 1, 2026
Merged

Allow custom build configurations in MigrationsBundleCommand#38206
AndriySvyryd merged 1 commit into
dotnet:mainfrom
m-x-shokhzod:fix/migrations-bundle-custom-config

Conversation

@m-x-shokhzod
Copy link
Copy Markdown
Contributor

Fixes #38193.

Problem

dotnet ef migrations bundle --configuration <Name> only forwarded the configuration to the inner dotnet publish call when the value was Debug or Release. Any other configuration name (e.g. EfBundle) was silently dropped, so the bundle was built with the default configuration instead of the one the user requested.

Root cause

The Debug/Release whitelist was added in 1422c65 ("Bundles: Flow configuration from project", #25906) so that auto-detected project configurations would not flow through unfiltered. However, the same check also blocked user-explicit --configuration values, which by then had already been validated by dotnet publish itself.

Fix

Forward the configuration whenever it is non-empty. dotnet publish is responsible for validating that the configuration name exists in the project; the ef tool should not second-guess it.

 var configuration = Configuration!.Value();
-if (string.Equals(configuration, "Debug", StringComparison.OrdinalIgnoreCase)
-    || string.Equals(configuration, "Release", StringComparison.OrdinalIgnoreCase))
+if (!string.IsNullOrEmpty(configuration))
 {
     publishArgs.Add("--configuration");
     publishArgs.Add(configuration!);
 }

Verification

  • Builds clean for both net472 and net10.0 targets of src/ef/ef.csproj.
  • Existing test/ef.Tests suite passes (6/6).

The execution path of MigrationsBundleCommand.Execute shells out to dotnet publish and is not unit-tested today; happy to extract the publish-args construction into a testable helper if reviewers prefer.

Previously only Debug and Release configurations were forwarded to
dotnet publish; any other configuration name was silently dropped,
causing the bundle to be built with the default configuration
instead of the one the user specified.

Fixes dotnet#38193
@AndriySvyryd AndriySvyryd enabled auto-merge (squash) May 1, 2026 21:34
@AndriySvyryd
Copy link
Copy Markdown
Member

Thanks for your contribution

@AndriySvyryd AndriySvyryd merged commit eaad45a into dotnet:main May 1, 2026
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MigrationsBundleCommand ignores build configurations other than Release and Debug

2 participants