Your target project doesn't match your migrations assembly ,have you seen this issue while working on migration. Please let me know why this issue faced
Loading
Your target project doesn't match your migrations assembly ,have you seen this issue while working on migration. Please let me know why this issue faced
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sachin SinghRank #66 · 26.2K reputationPosted Jan 30, 2023, 5:11 AM EST
@Ankush,
In your package Manager Console, there is a dropdown where you need to select the project that includes the DBContext file or Migration Folder, and make sure there is no pending migration.
If you are firing migration from local with live connection string then check the migration file inside live/production server database, it should be present there and latest migration file name should match to your local migration folder's last migration file name.
Then this error will be resolved.
Vishal JoshiRank #377 · 6.7K reputationPosted Jan 30, 2023, 4:12 AM EST
Hello
The target project should be the project that contains the migrations assembly, and the migration assembly is the assembly that contains the DbContext. If you are using visual studio for development, you just need to change the default project to the class library project that contains the DbContext.
For NET Core CLI, the default project can be mentioned in the migration command as given below.
dotnet ef migrations add NewMigration --project WebApplication.DataAccessThanks
Naimish MakwanaRank #324 · 7.7K reputationPosted Jan 30, 2023, 4:11 AM EST
Hello Ankush,
Please refer below link:
https://github.com/dotnet/efcore/issues/5900#issuecomment-229483068
Thanks
Naimish