ef migrations bundle doesn't work on Linux without `.exe` extension
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
### Bug description
I'm using `dotnet ef migrations bundle` to create a standalone executable to perform migrations at install time. This works fine on Windows, but on Linux I change the `--output` parameter to drop the .`exe` extension, this fails with an "Ambiguous project name" error. If I re-add the `.exe` extension, it works fine, but produces an `.exe` which needs renaming.
### Your code
```csharp
dotnet ef migrations bundle --output /home/root-directory/.deploy/development/ProjectName.Web.Migrations/ProjectName.Web.Migrations --project /home/root-directory/ProjectName/ProjectName.Infrastructure/ProjectName.Infrastructure.csproj --startup-project /home/root-directory/ProjectName/ProjectName.Web/ProjectName.Web.csproj --configuration Release --target-runtime linux-x64 --verbose --force
```
### Stack traces
```text
/home/cdtr/.dotnet/sdk/9.0.304/NuGet.targets(186,5): error : Ambiguous project name 'ProjectName.Web'. [/tmp/nvycmecj.a3x/ProjectName.Web.csproj]
Microsoft.EntityFrameworkCore.Tools.CommandException: Build failed. Use --verbose to see errors.
at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsBundleCommand.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.b__0(String[] args)
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
```
### Verbose output
```text
Using project '/home/root-directory/ProjectName/ProjectName.Infrastructure/ProjectName.Infrastructure.csproj'.
Using startup project '/home/root-directory/ProjectName/ProjectName.Web/ProjectName.Web.csproj'.
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=/tmp/tmpZpHCbl.tmp /verbosity:quiet /nologo /home/root-directory/ProjectName/ProjectName.Infrastructure/ProjectName.Infrastructure.csproj
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=/tmp/tmpWWUPav.tmp;Configuration=Release /verbosity:quiet /nologo /home/root-directory/ProjectName/ProjectName.Web/ProjectName.Web.csproj
Build started...
dotnet build /home/root-directory/ProjectName/ProjectName.Web/ProjectName.Web.csproj --configuration Release /verbosity:quiet /nologo /p:PublishAot=false
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.72
Build succeeded.
dotnet exec --depsfile /home/root-directory/ProjectName/ProjectName.Web/bin/Release/net9.0/ProjectName.Web.deps.json --additionalprobingpath /home/cdtr/.nuget/packages --runtimeconfig /home/root-directory/ProjectName/ProjectName.Web/bin/Release/net9.0/ProjectName.Web.runtimeconfig.json /home/cdtr/.nuget/packages/dotnet-ef/9.0.8/tools/net8.0/any/tools/netcoreapp2.0/any/ef.dll migrations bundle --output /home/root-directory/.deploy/development/ProjectName.Web.Migrations/ProjectName.Web.Migrations --target-runtime linux-x64 --force --assembly /home/root-directory/ProjectName/ProjectName.Web/bin/Release/net9.0/ProjectName.Infrastructure.dll --project /home/root-directory/ProjectName/ProjectName.Infrastructure/ProjectName.Infrastructure.csproj --startup-assembly /home/root-directory/ProjectName/ProjectName.Web/bin/Release/net9.0/ProjectName.Web.dll --startup-project /home/root-directory/ProjectName/ProjectName.Web/ProjectName.Web.csproj --project-dir /home/root-directory/ProjectName/ProjectName.Infrastructure/ --root-namespace ProjectName.Infrastructure --language C# --framework net9.0 --configuration Release --nullable --working-dir /home/root-directory/ProjectName --verbose
Using assembly 'ProjectName.Infrastructure'.
Using startup assembly 'ProjectName.Web'.
Using application base '/home/root-directory/ProjectName/ProjectName.Web/bin/Release/net9.0'.
Using working directory '/home/root-directory/ProjectName/ProjectName.Web'.
Using root namespace 'ProjectName.Infrastructure'.
Using project directory '/home/root-directory/ProjectName/ProjectName.Infrastructure/'.
Remaining arguments: .
Finding DbContext classes...
Using environment 'Development'.
Finding IDesignTimeDbContextFactory implementations...
Finding DbContext classes in the project...
Found DbContext 'HubDatabaseContext'.
Finding application service provider in assembly 'ProjectName.Web'...
Finding Microsoft.Extensions.Hosting service provider...
Using application service provider from Microsoft.Extensions.Hosting.
Using context 'HubDatabaseContext'.
Building bundle...
dotnet publish --runtime linux-x64 --output /tmp/nvycmecj.a3x/publish --no-self-contained --configuration Release --disable-build-servers
Determining projects to restore...
/home/cdtr/.dotnet/sdk/9.0.304/NuGet.targets(186,5): error : Ambiguous project name 'ProjectName.Web'. [/tmp/nvycmecj.a3x/ProjectName.Web.csproj]
Microsoft.EntityFrameworkCore.Tools.CommandException: Build failed. Use --verbose to see errors.
at Microsoft.EntityFrameworkCore.Tools.Commands.MigrationsBundleCommand.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.b__0(String[] args)
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
Build failed. Use --verbose to see errors.
```
### EF Core version
9.0.8
### Database provider
Microsoft.EntityFrameworkCore.SqlServer
### Target framework
.NET 9.0
### Operating system
Ubuntu 24
### IDE
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.