efcore icon indicating copy to clipboard operation
efcore copied to clipboard

dotnet-ef on Linux results in MSB3552: Resource file "**/*.resx" cannot be found

Open Soeren-WBS opened this issue 10 months ago • 17 comments

Error

dotnet-ef --version 10.0.2 - Throws Exception

`/opt/hostedtoolcache/dotnet/sdk/10.0.102/Microsoft.Common.CurrentVersion.targets(3442,5): error MSB3552: Resource file "**/*.resx" cannot be found. [/home/vsts/work/1/s/src/xxx/xxx/xxx.csproj] 0 Warning(s) 1 Error(s)

Time Elapsed 00:00:02.45

Microsoft.EntityFrameworkCore.Tools.CommandException: Build failed. Use dotnet build to see the errors. at Microsoft.EntityFrameworkCore.Tools.Project.Build(IEnumerable1 additionalArgs) at Microsoft.EntityFrameworkCore.Tools.RootCommand.Execute(String[] _) at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0(String[] args) at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args) at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)

-> In version 10.0.1 this error did not occured. Error was thrown in a pipeline using efcore-migration-script-generator-task@1

Links

No response

Root Cause

unknown

Blocking

  • [ ] This issue is blocking

Affected Releases

  • [x] .NET 10
  • [ ] .NET 10 (SDK band build)
  • [ ] .NET 11

Soeren-WBS avatar Jan 14 '26 09:01 Soeren-WBS

I assume this also happens with just dotnet build right? looks similar to https://github.com/dotnet/sdk/issues/10172

akoeplinger avatar Jan 14 '26 10:01 akoeplinger

It is similar, but it's only related to dotnet-ef tool 10.0.2.

I can reproduce this on my linux machine.

With dotnet-ef tool version 10.0.1:

 dotnet ef migrations bundle --project "myproject" --configuration Release --verbose

produces efbundle binary in the current dir and proper files in my bin directory not tracked in git.

But dotnet-ef tool version 10.0.2 it additionally generates a Windows-like path in my repo:

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	"myproject/bin\\Release/"

I guess this is the reason that later in CI when building my container I get the same error as @Soeren-WBS

konradmalik avatar Jan 14 '26 11:01 konradmalik

We've run into the same issue.

As a workaround for building the migrations bundle, you can first build the startup project using dotnet build and then use --no-build option when generating the bundle. Note that if you're cross-compiling, the startup project needs to be built for the current host RID, not the target RID!

ffried avatar Jan 14 '26 14:01 ffried

There were only 2 relevant PRs between 10.0.1 and 10.0.2:

  • https://github.com/dotnet/efcore/pull/37207
  • https://github.com/dotnet/efcore/pull/37301

Try adding --framework net10.0 to the command line and making sure that only v10+ SDKs are installed on the machine. If that doesn't work please share a small project that shows the issue.

AndriySvyryd avatar Jan 14 '26 20:01 AndriySvyryd

We have the same issue in a github action running on ubuntu-latest runner. Executing the command locally on windows in powershell does not have this issue.

rdrooij avatar Jan 15 '26 09:01 rdrooij

Repro project: EFCoreMigrationBundleRepro.zip

Extract it, change into the EFCoreMIgraitonBundleRepro directory and run docker build -t ef-core-migration-bundle-repro . The Dockerfile uses mcr.microsoft.com/dotnet/sdk:10.0.102, so it should only have the v10 SDK.

I can also reproduce it locally on macOS (also only having the v10 SDK installed):

  • Make sure no obj and bin folders are present from a previous build (since building the project first will work):
    • rm -rf bin* obj*
  • Run dotnet restore
  • Run dotnet ef migrations bundle --verbose --project EFCoreMigrationBundleRepro.csproj --configuration release

This will generate the error as well, and you can also see that a bin\release directory is created (vs. bin/release which would be correct on macOS / Linux).

Adding --framework net10.0 does not help (neither in Docker nor locally).

ffried avatar Jan 15 '26 10:01 ffried

Spent a whole day debugging why ef core migration in ubuntu Azure Pipeline doesn't work. Downgraded to 10.0.1 and it work just fine.

popiazaza avatar Jan 15 '26 13:01 popiazaza

can confirm this happens with migration add aswell

fteotini avatar Jan 15 '26 13:01 fteotini

Workaround until the version is fixed:

 dotnet tool install --global dotnet-ef --version 10.0.1
 dotnet tool restore
 dotnet ef database update 

Pieeer1 avatar Jan 16 '26 18:01 Pieeer1

Hitting the same issue, but in CI and only for dotnet-ef invocations I can run the same commands locally via WSL without an issue, however like @konradmalik I am getting a weird file added to the directory

pinkfloydx33 avatar Jan 19 '26 17:01 pinkfloydx33

have same problem. only on linux and only when ef builds the project internally. normal dotnet build works and on windows all works too

CI log:

2026-01-21T18:59:01.5976451Z [36;1mdotnet tool install --global dotnet-ef[0m
2026-01-21T18:59:01.5977067Z [36;1mdotnet restore[0m
2026-01-21T18:59:01.5977828Z [36;1mdotnet ef dbcontext info --startup-project AV.DMS --project AV.Data --verbose[0m
2026-01-21T18:59:01.5979351Z [36;1mdotnet ef migrations list --no-connect --no-build --startup-project AV.DMS --project AV.Data[0m
2026-01-21T18:59:01.6015361Z shell: /usr/bin/bash -e {0}
2026-01-21T18:59:01.6015897Z ##[endgroup]
2026-01-21T18:59:08.2017481Z You can invoke the tool using the following command: dotnet-ef
2026-01-21T18:59:08.2019508Z Tool 'dotnet-ef' (version '10.0.2') was successfully installed.
2026-01-21T18:59:10.0089105Z   Determining projects to restore...
2026-01-21T18:59:17.6009128Z   Restored /home/runner/work/av-dms/av-dms/AV.Data/AV.Data.csproj (in 7.03 sec).
2026-01-21T18:59:17.6466288Z   Restored /home/runner/work/av-dms/av-dms/AV.DMS/AV.DMS.csproj (in 7.1 sec).
2026-01-21T18:59:18.7741809Z Using project '/home/runner/work/av-dms/av-dms/AV.Data/AV.Data.csproj'.
2026-01-21T18:59:18.7743673Z Using startup project '/home/runner/work/av-dms/av-dms/AV.DMS/AV.DMS.csproj'.
2026-01-21T18:59:18.7912545Z dotnet msbuild /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 /home/runner/work/av-dms/av-dms/AV.Data/AV.Data.csproj
2026-01-21T18:59:19.6429332Z dotnet msbuild /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 /home/runner/work/av-dms/av-dms/AV.DMS/AV.DMS.csproj
2026-01-21T18:59:20.6065390Z Build started...
2026-01-21T18:59:20.6069593Z dotnet build /home/runner/work/av-dms/av-dms/AV.DMS/AV.DMS.csproj /verbosity:quiet /nologo /p:PublishAot=false
2026-01-21T18:59:23.5448676Z /usr/share/dotnet/sdk/10.0.101/Microsoft.Common.CurrentVersion.targets(3442,5): error MSB3552: Resource file "**/*.resx" cannot be found. [/home/runner/work/av-dms/av-dms/AV.Data/AV.Data.csproj]
2026-01-21T18:59:23.5830874Z 
2026-01-21T18:59:23.5840904Z Build FAILED.
2026-01-21T18:59:23.5888589Z 
2026-01-21T18:59:23.5890020Z /usr/share/dotnet/sdk/10.0.101/Microsoft.Common.CurrentVersion.targets(3442,5): error MSB3552: Resource file "**/*.resx" cannot be found. [/home/runner/work/av-dms/av-dms/AV.Data/AV.Data.csproj]
2026-01-21T18:59:23.5891617Z     0 Warning(s)
2026-01-21T18:59:23.5891963Z     1 Error(s)
2026-01-21T18:59:23.5892168Z 
2026-01-21T18:59:23.5892336Z Time Elapsed 00:00:02.61
2026-01-21T18:59:23.6042451Z 
2026-01-21T18:59:23.7156314Z Microsoft.EntityFrameworkCore.Tools.CommandException: Build failed. Use dotnet build to see the errors.
2026-01-21T18:59:23.7160362Z    at Microsoft.EntityFrameworkCore.Tools.Project.Build(IEnumerable`1 additionalArgs)
2026-01-21T18:59:23.7165976Z    at Microsoft.EntityFrameworkCore.Tools.RootCommand.Execute(String[] _)
2026-01-21T18:59:23.7190189Z    at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0(String[] args)
2026-01-21T18:59:23.7191653Z    at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
2026-01-21T18:59:23.7192760Z    at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
2026-01-21T18:59:23.7193987Z Build failed. Use dotnet build to see the errors.
2026-01-21T18:59:23.7419880Z ##[error]Process completed with exit code 1.

autoit4you avatar Jan 22 '26 08:01 autoit4you

Same issue here!

mhosman avatar Jan 25 '26 11:01 mhosman

Same issue here on ubuntu-latest in github actions.

Runs fine on windows.

Switched ef tools to 10.0.1 to resolve the issue. As @Pieeer1 suggested.

Tarek-At-Alinor avatar Jan 26 '26 19:01 Tarek-At-Alinor

Yeah, this broke our build pipeline. Both bundle and script fail in the same sort of way.

mdsharpe avatar Jan 28 '26 15:01 mdsharpe

Same issue here, now lets wait for 10.0.4 Running 10.0.1 in the meantime

etamminga avatar Feb 10 '26 14:02 etamminga

I had the same.. the core issue was a package at this path:

/userprofile/my/dev/folder/bin\Debug

When I deleted it, it worked again.

NPadrutt avatar Feb 12 '26 22:02 NPadrutt

Same problem here. Downgraded to an older version

Image

tymongumienik avatar Feb 22 '26 07:02 tymongumienik