Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code-First Migrations MissingManifestResourceException

I am currently working on creating the InitialCreate migration for a new database. I am new to this migration framework and do not know exactly what it generates, I have been running update-database to see the result, dropping the database then running update-database again after making some changes to see the results.

Twice now I have made some changes, went to run the update and gotten an error like this:

Applying code-based migration: 201209121936571_InitialCreate. System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "$assemblyName$.resources" was correctly embedded or linked into assembly "$assemblyName$" at compile time, or that all the satellite assemblies required are loadable and fully signed. at [StackTrace]

Then it ends in red with

Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "$assemblyName$.Migrations.InitialCreate.resources" was correctly embedded or linked into assembly "$assemblyName$" at compile time, or that all the satellite assemblies required are loadable and fully signed.

The first time I encountered this I dropped the migration folder, ran enable-migrations re-made my changes and was able to run the migration.

It has happened again and I am not wanting to have to recreate the files every time this happens. Does anyone know how to correct this to make the migration work again?

like image 836
vossad01 Avatar asked Dec 05 '22 14:12

vossad01


1 Answers

For me solution was to add folowing code in .csproj file of my projected, inside <PropertyGroup>

<EmbeddedResourceUseDependentUponConvention>true</EmbeddedResourceUseDependentUponConvention>

Afted that Update-Database command worked fine.

like image 71
Filip B. Avatar answered Feb 11 '23 17:02

Filip B.