Stian
Stian

Reputation: 1602

Could not find any resource appropriate for the specified culture or neutral culture

Yesterday, I got the error message

Could not get the reflection type for DbContext

when trying to add a new controller. I have many controllers in my solution already, so I don't know why this suddenly occured.

Then I followed the solution given to this question, and now I'm faced with a new error message:

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

I don't understand what this error message means.

The resource file contains a long list of zip codes in JSON format, which are seeded into the database upon initial migration.

UPDATE

I have tried adding this to the csproj, but I still get the same error message:

<ItemGroup>
    <EmbeddedResource Include="DbSeedingResource.resx" />
</ItemGroup>

UPDATE 2

I tried removing the resx-file from my project, and then I got this error again:

Could not get the reflection type for DbContext

Upvotes: 1

Views: 8288

Answers (2)

Shewan
Shewan

Reputation: 81

I had a similar problem when trying to run an EF migration, I think the same answer will apply.

My error was

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

In VS Solution Explorer I clicked the triangle beside the file to see the .resx file, and I noticed that the resx file for the migration wasn't included in the solution:

enter image description here

I right clicked on the offending .resx file, include in solution, and he little 'missing file' icon was replaced by something more reassuring and boom! it all worked.

enter image description here

Not sure how the issue crept in, but happy to have a fix.

Upvotes: 0

Mari Faleiros
Mari Faleiros

Reputation: 738

Had a similar issue for a NetCore project and I noticed that after I added my migration (let's name it WhateverMigration), the .resx file reference as EmbeddedResource was not added to the .csproj even tho everything seemed fine. So I opened my .csproj file and I added:

<EmbeddedResource Update="Migrations\202107071914322_WhateverMigration.resx">
    <Generator></Generator>
    <DependentUpon>202107071914322_WhateverMigration.cs</DependentUpon>
</EmbeddedResource>

Upvotes: 3

Related Questions