-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Runtime for migration bundle creation in Net7 #30466
Comments
This is a change in behavior in the SDK between 6 and 7. Moving to the sdk repo. /cc @bricelam |
I assume /Bricelam owns the ef bundle creation. I'm guessing that you use a property like I wouldn't be surprised if there isn't much that the ef migrations team could do about this, but IDK how their code works. |
Here's a repro project that takes <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<PublishSingleFile>True</PublishSingleFile>
<IncludeNativeLibrariesForSelfExtract>True</IncludeNativeLibrariesForSelfExtract>
<ValidateExecutableReferencesMatchSelfContained>False</ValidateExecutableReferencesMatchSelfContained>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\App\App.csproj">
<!-- HACK: Work around dotnet/sdk#10566 -->
<GlobalPropertiesToRemove>SelfContained</GlobalPropertiesToRemove>
</ProjectReference>
</ItemGroup>
</Project> |
@bricelam FYI that hack shouldn't be needed anymore in net 7.0. Thank you for creating a repro project. Are you expecting anything from the SDK on this end? I tried to use the repro project but |
I wasn't able to repro it either. I think we're missing a piece of the puzzle.
True, but trying to figure out which version of the SDK they're using is a lot more work than just leaving it in. 😉 |
@DavidCMulder May you please provide a log (note the privacy notice) to help us debug this? |
Hi @nagilson, I have attached the output in a zip, together with the powershell console output. |
I also had a go with the repro App project, and I have the same error there. |
Or if I stick to the windows platform and remove the previously downloadeded microsoft.netcore.app.runtime.win-x64 package
|
I also just came across a (I think) related issue: 29589 |
I just stumbled on this issue with GitHub Actions running on
The steps that end up with the above error: - name: Build
run: dotnet build -c Release src/Ultima.sln
- name: Run tests
run: dotnet test -c Release --no-build src/Ultima.sln
- name: Export ERP
run: dotnet publish -c Release -o dist/erp --no-build src/Ultima.Erp
- name: Create migrations bundle
run: dotnet ef migrations bundle -o update-db --configuration Release --no-build -v
working-directory: src/Ultima.Erp |
If someone getting hit the same issue as mine just use jobs:
build:
name: Build
runs-on: ubuntu-22.04
container: mcr.microsoft.com/dotnet/sdk:6.0 |
This separate The build log also contains this warning for the
But there is no |
Sorry this issue got lost, thanks for providing the logs long ago. I think the best option is to do a
You should also be able to add |
It looks like the EF tools even uses the
|
FWIW, that error should be gone in .NET 8, but that is odd behavior. @bricelam Do the EF project targets perhaps undefine SelfContained somehow? |
Yes. It used to cause errors if we let it flow to referenced projects. |
#10566 which is mentioned there seems to have been fixed for .NET 7. So maybe that workaround should be removed? |
flags
you should use
|
But why do we even have to specify a runtime? It's not a required parameter for the |
The ef tool shouldn't change the meaning of the well-known -r switch. Users expect the flag to mean --runtime like it does for every other dotnet CLI command. |
Has this been fixed in .NET 8 (or EF Core 8)? Seems like I can't reproduce it any more with EF Core 8. |
Still persist: Cannot generate bundle within ASP.NET Blazor project with WASM:
|
I upgrade my .NET 6 Blazor Project to a .NET8 Blazor Web Application with WASM. I use seperate EF Mirgraion projects for Oracle and for Postgres. Exact same error as @eerojaaskelainen . @nagilson, @bricelam is there a workaround so I can use This is part of my Log dotnet ef migrations bundle --verbose --project ./Migrations/Project.Migrations.Postgres/Project.Migrations.Postgres.csproj --startup-project ./Server/Project.Server.csproj --context ProjectDbContext --output ./efbundle-postgres
...
Building bundle...
dotnet publish --runtime win-x64 --output C:\Users\<USERNAME>\AppData\Local\Temp\mxqvfvux.feo\publish --no-self-contained`
...
\.nuget\packages\microsoft.net.sdk.webassembly.pack\8.0.10\build\Microsoft.NET.Sdk.WebAssembly.Browser.targets(228,5): error WASM0005: Unable to resolve WebAssembly runtime pack version [C:\<PATH_TO_PROJECT>\ClientProject.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.<Configure>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. |
Facing the same issue with .net 8 Blazor Web App WASM when trying to build bundle migration
|
When I create a migration bundle and do not specify a runtime, it looks like the subsequent build step does not specify a runtime. The creation of the bundle (from the verbose logging: dotnet publish --runtime win-x64) however does specify a runtime. This part then fails with 'error NETSDK1112: The runtime pack for Microsoft.NETCore.App.Runtime.win-x64 was not downloaded.'.
I can work around this by running a build specifying the runtime, and then a 'dotnet ef migrations bundle --no-build' succeeds.
So for example on my windows dev machine this fails:
error: 'error NETSDK1112: The runtime pack for Microsoft.NETCore.App.Runtime.linux-x64 was not downloaded. Try running a NuGet restore with the RuntimeIdentifier 'linux-x64''
and this succeeds:
I think that when creating a bundle, the build and publishing of the bundle should specify the same runtime.
The text was updated successfully, but these errors were encountered: