Bundle-Migration failing

See original GitHub issue

I’ve tried to build a migration bundle in my project and it keeps failing with the following error:

‘dotnet-ef migrations bundle -c MyContext --verbose’

C:\Program Files\dotnet\sdk\6.0.100-rc.2.21505.57\NuGet.targets(466,5): error MSB4044: The "GetRestoreProjectStyleTask" task was not given a value for the required parameter "MSBuildProjectName". [C:\Users\daniel.thompson\AppData\Local\Temp\d1f02d5t.l2d\.csproj]

My project builds and runs fine and this gives me the same error in both an admin terminal and the Package Manager Console.

I’ve tried this on a few of the latest different version of net6.0/efcore and have even just tested on the absolute latest nuget Daily Builds with the same results.

Am I missing something simple for the new Migration Bundles? Any ideas?

image

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
unsprungcommented, Nov 25, 2022

This part is most strange to me: \.csproj

That shouldn’t be possible unless you’re specifying an output path with a filename that starts with .

For future reference for anyone else; I had this problem when --output was specified as a directory. It seems it must be a filename AND the complete folder path to the file must already exist.

0reactions
DanoThomcommented, Nov 11, 2021

Just an FYI, I managed to solve this issue after playing around a bit more.

@bricelam I agree, I went through everything with a fine tooth comb and none of the error messages I got out made much sense or pointed towards anything meaningful.

The project is far too big to provide any meaningful repro without zipping the whole thing which isn’t an option.

I upgraded both the runtime and the efcore tools to net6 instead of the RC but the issue persisted. So it wasn’t the RC. I then created a new net6 AspNetCore API project and pulled in all of the dependencies, linked to the domain and infra projects where the dbContext in question lived and created a new migration. Worked through the issues that popped up until I could successfully generate a migration bundle in the new test project.

I ended up having to create a more simplified DbContext Ctor (was a stretch based on one of the errors): image

I also had to explicitly add some of the EF Core libraries to the infra project file: image

I still then encountered the known issue (very annoying) where the project locks the dll in the bin file (https://github.com/dotnet/efcore/issues/25555#issue-972922554) but I used the LockHunter app to unlock the project dll and it finally successfully generated the migration bundle.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Entity Framework Core 6 Migration Bundle Execution Error
I am trying to use the new EF Core migration bundle to update my database schema. I have created the bundle using: dotnet...
Read more >
Bundle Migration Failed To Import With Error
Bundle Migration Failed To Import With Error - The << DDS >>, dynamic data set in the destination environment has a conflict with...
Read more >
Applying Migrations - EF Core
This can leave your database in an undefined state if a failure occurs when applying migrations. Bundles can be generated as part of...
Read more >
Migration fails for missing paragraph bundle [#3228554]
Problem /Motivation If data is missing in paragraphs_bundle table, migration will fail with error Undefined array key "paragraph_bundle_name" ...
Read more >
Bundle Migration fails with "Exception Thrown Array cannot be ...
Situation. Migrating ZDM7 applications to ZCM 10 bundles. Exception Thrown Array cannot be null. Parameter name: bytes in Migrate Stack ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found