Skip to content

MigrationsBundleCommand ignores build configurations other than Release and Debug #38193

@forsti83

Description

@forsti83

Bug description

If I use the MigrationsBundleCommand in EF tooling with a custom build configuration, the configuration is ignored in the publish command for the efbundle.exe and the default Release config is used. Is there any reason to not allow other build configs here?

MigrationsBundleCommand.cs in lines 164-170:

Image

Your code

dotnet ef migrations bundle --configuration EfBundle --project Server\xy.Server.DataModel

Stack traces


Verbose output

PM> dotnet ef migrations bundle --configuration EfBundle --project Server\xy.Server.DataModel --force --verbose
Using project 'C:\Solutions\PROJECT\src\Server\Server\xy.Server.DataModel\xy.Server.DataModel.csproj'.
Using startup project 'C:\Solutions\PROJECT\src\Server\Server\xy.Server.DataModel\xy.Server.DataModel.csproj'.
dotnet msbuild /property:Configuration=EfBundle /getProperty:ProjectName /getProperty:AssemblyName /getProperty:DesignAssembly /getProperty:Language /getProperty:OutputPath /getProperty:PlatformTarget /getProperty:ProjectAssetsFile /getProperty:ProjectDir /getProperty:RootNamespace /getProperty:RuntimeFrameworkVersion /getProperty:TargetFileName /getProperty:TargetFrameworkMoniker /getProperty:Nullable /getProperty:TargetFramework /getProperty:TargetPlatformIdentifier /getProperty:Platform /t:ResolvePackageAssets /getItem:RuntimeCopyLocalItems C:\Solutions\PROJECT\src\Server\Server\xy.Server.DataModel\xy.Server.DataModel.csproj
dotnet : C:\Solutions\PROJECT\src\Server\Server\xy.Server.DataModel\xy.Server.DataModel.csproj : warning NU1903: Package 'System.IO.Packaging' 6.0.0 has a known high severity vulnerability, https://github.com/advisories/GHSA-f32c-w444-8ppv
At line:1 char:1
+ dotnet ef migrations bundle --configuration EfBundle --project Server ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (C:\Solutions\XR...-f32c-w444-8ppv:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
dotnet msbuild /property:Configuration=EfBundle /getProperty:ProjectName /getProperty:AssemblyName /getProperty:DesignAssembly /getProperty:Language /getProperty:OutputPath /getProperty:PlatformTarget /getProperty:ProjectAssetsFile /getProperty:ProjectDir /getProperty:RootNamespace /getProperty:RuntimeFrameworkVersion /getProperty:TargetFileName /getProperty:TargetFrameworkMoniker /getProperty:Nullable /getProperty:TargetFramework /getProperty:TargetPlatformIdentifier /getProperty:Platform /t:ResolvePackageAssets /getItem:RuntimeCopyLocalItems C:\Solutions\PROJECT\src\Server\Server\xy.Server.DataModel\xy.Server.DataModel.csproj
Build started...
dotnet build C:\Solutions\PROJECT\src\Server\Server\xy.Server.DataModel\xy.Server.DataModel.csproj --configuration EfBundle /verbosity:quiet /nologo /p:PublishAot=false

Build succeeded.

... warnings ...

    16 Warning(s)
    0 Error(s)

Time Elapsed 00:00:07.27

Build succeeded.
dotnet exec --depsfile C:\Solutions\PROJECT\Deployment\Server\xy.Server.DataModel\EfBundle\net10.0\xy.Server.DataModel.deps.json --additionalprobingpath C:\Users\USER\.nuget\packages --additionalprobingpath "C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages" --runtimeconfig C:\Solutions\PROJECT\Deployment\Server\xy.Server.DataModel\EfBundle\net10.0\xy.Server.DataModel.runtimeconfig.json C:\Users\USER\.dotnet\tools\.store\dotnet-ef\10.0.5\dotnet-ef\10.0.5\tools\net8.0\any\tools\net8.0\any\ef.dll migrations bundle --force --assembly C:\Solutions\PROJECT\Deployment\Server\xy.Server.DataModel\EfBundle\net10.0\xy.Server.DataModel.dll --project C:\Solutions\PROJECT\src\Server\Server\xy.Server.DataModel\xy.Server.DataModel.csproj --startup-assembly C:\Solutions\PROJECT\Deployment\Server\xy.Server.DataModel\EfBundle\net10.0\xy.Server.DataModel.dll --startup-project C:\Solutions\PROJECT\src\Server\Server\xy.Server.DataModel\xy.Server.DataModel.csproj --project-dir C:\Solutions\PROJECT\src\Server\Server\xy.Server.DataModel\ --root-namespace xy.Server.DataModel --language C# --framework net10.0 --design-assembly C:\Users\USER\.nuget\packages\microsoft.entityframeworkcore.design\10.0.3\lib\net10.0\Microsoft.EntityFrameworkCore.Design.dll --configuration EfBundle --nullable --working-dir C:\Solutions\PROJECT\src\Server --verbose
Using assembly 'xy.Server.DataModel'.
Using startup assembly 'xy.Server.DataModel'.
Using application base 'C:\Solutions\PROJECT\Deployment\Server\xy.Server.DataModel\EfBundle\net10.0'.
Using working directory 'C:\Solutions\PROJECT\src\Server\Server\xy.Server.DataModel'.
Using root namespace 'xy.Server.DataModel'.
Using project directory 'C:\Solutions\PROJECT\src\Server\Server\xy.Server.DataModel\'.
Remaining arguments: .
Finding DbContext classes...
Using environment 'Development'.
Finding IDesignTimeDbContextFactory implementations...
Found IDesignTimeDbContextFactory implementation 'DatabaseContextMigrationFactory'.
Found DbContext 'DatabaseContext'.
Finding DbContext classes in the project...
Using DbContext factory 'DatabaseContextMigrationFactory'.
Using context 'DatabaseContext'.
Creating DbConnection.
Created DbConnection. (23ms).
'DatabaseContext' disposed.
Disposing connection to database 'xy_db' on server 'DB_SERVER'.
Disposed connection to database '' on server '' (3ms).
Building bundle...
dotnet publish --runtime win-x64 --output C:\Users\USER\AppData\Local\Temp\ohs244wr.1hr\publish --no-self-contained --disable-build-servers
  Determining projects to restore...
  Restored C:\Users\USER\AppData\Local\Temp\ohs244wr.1hr\efbundle.csproj (in 675 ms).
  Restored C:\Solutions\PROJECT\src\Core\xy.Core\xy.Core.csproj (in 659 ms).
  Restored C:\Solutions\PROJECT\src\Server\Server\xy.Server.DataModel\xy.Server.DataModel.csproj (in 683 ms).
  xy.Core -> C:\Solutions\PROJECT\src\Core\Binaries\Release\net10.0\xy.Core.dll
  xy.Server.DataModel -> C:\Solutions\PROJECT\Deployment\Server\xy.Server.DataModel\Release\net10.0\xy.Server.DataModel.dll
  efbundle -> C:\Users\USER\AppData\Local\Temp\ohs244wr.1hr\bin\Release\net10.0\win-x64\efbundle.dll
  efbundle -> C:\Users\USER\AppData\Local\Temp\ohs244wr.1hr\publish\

Done. Migrations Bundle: C:\Solutions\PROJECT\src\Server\efbundle.exe

EF Core version

10.0.5

Database provider

No response

Target framework

.NET 10

Operating system

Windows 11

IDE

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions