[.net] Could not find any resources appropriate for the specified culture or the neutral culture

I have two ASP.NET Web projects (ProjectA and ProjectB). When class in ProjectA is instantiating a class of ProjectB which uses a resource file Blah.resx, I get this error:

An exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll but was not handled in user code.

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

Whats causing this?

There is an article on Microsoft's site about this http://support.microsoft.com/kb/318603 which suggests:

To resolve this problem, move all of the other class definitions so that they appear after the form's class definition.

This is a solution for Windows Forms project, I'm not sure if that also applies to Web projects.

This question is related to .net asp.net embedded-resource resourcemanager

The answer is


In my case a series of badly thought global text replacements had inadvertently changed this line in the resource designer cs file.

enter image description here

Since the namespace in that argument did not match the namespace of the class anymore, the application got confused at run time.

Check that the namespace of the designer matches the string argument in that line.


As far as this case is concerned check if the assembly containing resources has the default namespace set to the same text (Project->Properties->Default namespace; in VS) Check as well if the resx file has a property BuildAction set to "Embedded resource" Enjoy... ;)


When we were using

HttpContext.GetGlobalResourceObject()

It would generate that error unless we wrapped that call inside a try/catch statement.


One approach would be to put the shared classes/resources in a separate class library project and refer them in both the web sites.


I found that deleting the designer.cs file, excluding the resx file from the project and then re-including it often fixed this kind of issue, following a namespace refactoring (as per CFinck's answer)


Yet another cause: if your namespace has a hyphen ("-"), then it will build and run correctly, but the resource won't be accessible. Namespaces (identifiers) aren't supposed to have hyphens, but this doesn't appear to be enforced anywhere except in loading resources. This has burned me twice over the decade.


In my case these lines of code added to Web.config helped a lot:

<system.web>
     ...
    <globalization uiCulture="cs" culture="cs-CZ" />
     ...
<system.web>

Together with Build action: Embedded Resource and Custom Tool: PublicResXFileCodeGenerator.


I had the same issue when trying to run an update-database command on EF. Turns out the migration that was throwing the exception had the .resx file excluded from the project. I just right-clicked the .resx file and clicked "Include In Project". Problem solved.


Thanks @CFinck ! Just to add a tip to others : I changed the ResourceManager line with this :

New Global.System.Resources.ResourceManager(Reflection.Assembly.GetCallingAssembly.GetName.Name & ".CommonNameOf.Resources", Reflection.Assembly.GetCallingAssembly())

I'm in vb.net but I think in C# the only difference would be + instead of & to concatenate strings.

This way I can use the same linked assembly files in two similar projects that share the resources.


No-one seems to have mentioned this solution. Obvious really - but tripped me over for a moment...

The default access modifier for a new resources file is Internal (or Friend in VB.Net.) Make sure you change this to Public

(in the resx designer there is a dropdown at the top for the access modifier)


I faced this issue for running Migration command.Update-Database in Package Manager console.

Accepted answer didn't solve my problem.

I had to change Build Action from Compile to Embedded Resource and It worked for me.

You can do the same using below steps:

  1. Right click on migration.
  2. Change the "Build Action" property "Compile" to "Embedded Resource"
  3. Run Update-Database command.

In my case, Build Action of the resource file was already Embedded Resource but every time I ran update-database, I got the same error, so i did the fellow steps and it's worked:

  1. Change Build Action property to Compile
  2. Build (got so many errors)
  3. Change back Build Action property to Embedded Resource
  4. update-database

And for some reason it's worked.


This can be caused by mismatched namespaces. The second from top answer (Sibi Elango's) says to right-click the resx file, and change Build option to EmbeddedResource, but I had already done that and still had the error. The top answer (CFinck's) notes a way of fixing this via manually editing files, however, I had this problem in MonoDevelop, and had to set the default namespace to the same as the cs file which was calling for the resource (the file which contained code such as the code below)...

this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));

After setting the default namespace via the GUI, the line above no longer caused an exception.


Just because you are referencing Project B's DLL doesn't mean that the Resource Manager of Project A is aware of Project B's App_GlobalResources directory.

Are you using web site projects or web application projects? In the latter, Visual Studio should allow you to link source code files (not sure about the former, I've never used them). This is a little-know but useful feature, which is described here. That way, you can link the Project B resource files into Project A.


Another thing to check is if you have LogicalName or ManifestResourceName defined on the EmbeddedResource. Make sure those are defined appropriately if your project file is using them as they can cause the resources to live under a name you are not expecting.


Sibi Elangos's answer alone was not sufficient for me, so I had to:

  • Right click on your ResourceFile
  • Change the "Build Action" property
  • Compile to "Embedded Resource"
  • Build and deploy

This will generate an App_GlobalResources in your /bin folder, now copy that folder also to the root of the web application


This error is also raised by Dotfuscation, since a resx designer file relies on reflection. If you are using Dotfuscator it will break your resx files. You must always add them as an exclusion from the obfuscation process.


In my case, the issue caused by the wrong order of class definitions. For example, I had added another class definition before my Form class:

namespace MyBuggyWorld
{
    public class BackendObject //This hack broke the VS 2017 winform designer and resources linker!
    {
        public TcpClient ActiveClient { get; set; }
        public BackgroundWorker ActiveWorker { get; set; }
    }

    public partial class FormMain : Form
    {
    }
}

After moving BackendObject to the end of the file (better yet would be to move it to a separate file), doing project clean + rebuild resolved the issue.


When I tried sharing a resource.resx file from one C# project with another C# project, I got this problem. The suggestion on moving the Form class to the beginning of its file wasn't appropriate. This is how I solved it. You essentially use a link from the second project to the first, then enable regeneration of the resource.designer.cs file.

  1. Delete the second project's Properties/Resources.resx file
  2. Add the first project's Properties/Resources.resx file as a LINK to the Properties folder in the second project. Don't add it to the root level of the project.
  3. Don't add the first project's Properties/Resources.designer.cs!
  4. On the properties of the second project's Resources.resx, add ResXFileCodeGenerator as the CustomTool
  5. Right click on the Resources.resx and select "Run Custom Tool". This will generate a new designer.cs file.

Note: I would avoid editing the resource.designer.cs file, as this is autogenerated.


I solved the problem like this:

  1. Right click on your ResourceFile
  2. Change the "Build Action" property Compile to "Embedded Resource"
  3. Then build and run

It works perfectly.


I was also facing the same issue, tried all the solutions mentioned in the answer but none seemed to work. Turned out that during the checkin of code to TFS. TFS did not checkin the Resx file it only checked in the designer file. So all other developers were facing this issue while running on their machines. Checking in the resx file manually did the trick


I just hit this same exception in a WPF project. The issue occurred within an assembly that we recently moved to another namespace (ProblemAssembly.Support to ProblemAssembly.Controls). The exception was happening when trying to access resources from a second resource file that exists in the assembly.

Turns out the additional resource file did not properly move references from the old namespace name to the new namespace name.

In the designer.cs for the resource file, there is a static property to get the ResourceManager. Within that getter, the string was still referring the old namespace. Once correcting it to the new namespace, the problem was resolved:

global::System.Resources.ResourceManager temp = 
     new global::System.Resources.ResourceManager(
          "ProblemAssembly.Support.Properties.Stuff", typeof(Stuff).Assembly);

should have been:

global::System.Resources.ResourceManager temp = 
     new global::System.Resources.ResourceManager(
          "ProblemAssembly.Controls.Properties.Stuff", typeof(Stuff).Assembly);

Hope this helps the next person.


It happens because the *.res? is excluded from migration.

  • Right click on your ResourceFile
  • Click on the menu item "Include in project"

For me the problem was copying .resx files and associated .cs files from one project to another. Both projects had the same namespace so that wasn't the problem.

Finally solved it when I noticed in Solution Explorer that in the original project the .resx files were dependent on the .cs files:

MyResource.cs
|_ MyResource.resx

While in the copied project the .cs files was dependent on the .resx files:

MyResource.resx
|_ MyResource.cs

It turned out that in the second project somehow the .resx files had been set to auto-generate the .cs files. The auto-generated .cs files were overwriting the .cs files copied from the original project.

To fix the problem edit the properties of each .resx file in the copied project. The Custom Tool property will be set to something like ResXFileCodeGenerator. Clear the Custom Tool property of the .resx file. You will need to re-copy the .cs file from the original project as it will have been overwritten by the auto-generated file.


I resolved this by going to the project where my resources file was saved, scrolling down to its ItemGroup and adding a logical name that corresponded to the path the compiler expected.

My EmbeddedResource looked like this:

   <ItemGroup>
    <EmbeddedResource Update="Properties\TextResources.resx">
      <Generator>PublicResXFileCodeGenerator</Generator>
      <LastGenOutput>TextResources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>

Now it looks like this

  <ItemGroup>
    <EmbeddedResource Update="Properties\TextResources.resx">
      <Generator>PublicResXFileCodeGenerator</Generator>
      <LastGenOutput>TextResources.Designer.cs</LastGenOutput>
      <LogicalName>MyProject.Properties.Resources.resources</LogicalName>
    </EmbeddedResource>
  </ItemGroup>

I have a WinForms application with a single project in the solution.
Targeting .NET Framework 4.0
Using SharpDevelop 4.3 as my IDE

Sounds silly, but I happened to have the Logical Name property set to "Resources" on my "Resources.resx" file. Once I cleared that property, all works hunky-dory.

Normally, when you add random files as EmbeddedResource, you generally want to set the Logical Name to something reasonable, for some reason, I did the same on the Resources.resx file and that screwed it all up...

Hope this helps someone.


For users who facing this isssue in .NET Core 3.0, this could be related to a breaking change that made in .NET Core 3.0, to resolve it just set EmbeddedResourceUseDependentUponConvention to false in your project csproj:

<PropertyGroup>
  <EmbeddedResourceUseDependentUponConvention>false</EmbeddedResourceUseDependentUponConvention>
</PropertyGroup>

Just another case. I copied a solution with two projects and renamed them partially in the Windows explorer (folder names, .sln and .csproj file names) and partially with a massive Find & Replace action in Visual Studio (namespaces etc.). Nevertheless the exception stated by the OP still occurred. I found out that the Assembly and Namespace names were still old.

Although the project and everything else was already named OfficeStyle the Assembly name and Default namespace were still named Linckus.

Old situation

After this correction everything worked fine again, compile and run time :)

New situation


Examples related to .net

You must add a reference to assembly 'netstandard, Version=2.0.0.0 How to use Bootstrap 4 in ASP.NET Core No authenticationScheme was specified, and there was no DefaultChallengeScheme found with default authentification and custom authorization .net Core 2.0 - Package was restored using .NetFramework 4.6.1 instead of target framework .netCore 2.0. The package may not be fully compatible Update .NET web service to use TLS 1.2 EF Core add-migration Build Failed What is the difference between .NET Core and .NET Standard Class Library project types? Visual Studio 2017 - Could not load file or assembly 'System.Runtime, Version=4.1.0.0' or one of its dependencies Nuget connection attempt failed "Unable to load the service index for source" Token based authentication in Web API without any user interface

Examples related to asp.net

RegisterStartupScript from code behind not working when Update Panel is used You must add a reference to assembly 'netstandard, Version=2.0.0.0 No authenticationScheme was specified, and there was no DefaultChallengeScheme found with default authentification and custom authorization How to use log4net in Asp.net core 2.0 Visual Studio 2017 error: Unable to start program, An operation is not legal in the current state How to create roles in ASP.NET Core and assign them to users? How to handle Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause() ASP.NET Core Web API Authentication Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0 WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jquery

Examples related to embedded-resource

Reading a resource file from within jar File loading by getClass().getResource() How do I add an image to a JButton How to read embedded resource text file Could not find any resources appropriate for the specified culture or the neutral culture Loop through all the resources in a .resx file Storing WPF Image Resources

Examples related to resourcemanager

Using ResourceManager Could not find any resources appropriate for the specified culture or the neutral culture