System.Resources.MissingManifestResourceException when Updating database

Slightly different situation, where I created a new environment, and database, and received the above error message.

For my fix, I had to right-click on the migration files (initial and resx) and set property to embedded as resource. Update-database command ran fine afterward.


For VS 2017, the solution is as follows:

Go to the project file, and for all of the migrations, apply the following format:

 <Compile Include="Migrations\201804251606403_emailsWithEffort.cs" />
<Compile Include="Migrations\201804251606403_emailsWithEffort.Designer.cs">
  <DependentUpon>201804251606403_emailsWithEffort.cs</DependentUpon>
</Compile>

    <EmbeddedResource Include="Migrations\201804251606403_emailsWithEffort.resx">
  <DependentUpon>201804251606403_emailsWithEffort.cs</DependentUpon>
</EmbeddedResource>

I guess that the problem is when changing version(s) of Visual Studio, old format of describing dependencies stays, and the Visual Studio 2017 can not interpret it correctly.

Hence, applying the format as described above (change your format to this), you can make the Visual Studio get the idea of where it's resources are.


I think the issue (one issue) is that the .resx file is added as "dependent upon" (nested under) the .cs file, and the way the build engine works, "dependent upon" changes the name that an embedded resource is saved with (something like, it changes from being based on the filename to being based on the type name; I've dealt with this in other scenarios but can't remember for sure).

This leads to problems when using SDK .csproj files, for some reason (I guess that by default SDK .csproj does not change the resource name in this situation, but the migrations system expects it to).

As someone else had posted, SDK .csproj can use the following tag to change the embedded resource naming scheme for "dependent upon" resources, which then allows the migrations system to find the embedded resource:

<EmbeddedResourceUseDependentUponConvention>
  true
</EmbeddedResourceUseDependentUponConvention>

This should go in a <PropertyGroup> of your SDK .csproj file.


I had a similar issue when the resx part of the migration was not included in the project file when a fellow developer checked the project in (probably due to a merge issue). You may find that the resx file is there but greyed out. If it's there, try right clicking the "NameofMigration.resx" file and selecting "include in project". If it's not there, you better go find it on the other machine and add it to the project :-)