[c#] What does MissingManifestResourceException mean and how to fix it?

The situation:

  • I have a class library, called RT.Servers, containing a few resources (of type byte[], but I don't think that's important)
  • The same class library contains a method which returns one of those resources
  • I have a simple program (with a reference to that library) that only calls that single method

I get a MissingManifestResourceException with the following message:

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

I have never played around with cultures, or with assembly signing, so I don't know what's going on here. Also, this works in another project which uses the same library. Any ideas?

This question is related to c# .net resources manifest culture

The answer is


I ran into a different cause of this problem, which was unrelated to resx files. I had a class library where AssemblyInfo.cs contained the following:

[assembly: ThemeInfo(
ResourceDictionaryLocation.SourceAssembly,
ResourceDictionaryLocation.SourceAssembly)]

The assembly did not contain any WPF code, theme or Resource dictionaries. I got rid of the exception by removing the ThemeInfo attribute.

I did not get an actual exception, only

A first chance exception of type 'System.Resources.MissingManifestResourceException'.

Viewing exception details, the system was requesting MyAssembly.g.resources

Hope this might be of help to someone else.


In my case it was a typo in the Xaml of a window opened from Winforms Form:

Incorrect: <Image Source="/Resources/WorkGreen.gif"/>

Correct: <Image Source="../Resources/WorkGreen.gif"/> It may help someone


Not sure it will help people but this one worked for me :

So the issue I had was that I was getting the following message:

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

I was trying to get the resources that were embedded in my project from another class library.

What I did to fix the problem was to set the Access Modifier in the tab Project->Properties->Resources from "Internal" (accessible only within the same class library) to "Public" (accessible from another class library)

Then run and voilĂ , no more error for me...


I just came across this problem today, and I found this Microsoft Help and Support page that actually did work around the problem.

I had a couple delegates at the top of my file, in the global namespace, and all of a sudden I was getting a MissingManifestResourceException when running the program, on this line:

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

Then I moved the delegates into the namespace, got the same error. Finally I put the delegates in the only class in that file, and the error went away, but I didn't want the delegates in that class or namespace.

Then I came across that link above, which said

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

I put the delegates (which I would not consider "class definitions") at the bottom of that file, outside of the local namespace, and the program didn't get the MissingManifestResourceException anymore. What an irritating error. But, that seems like a more robust solution than modifying the auto-generated code :)


Recently stumbled upon this issue, in my case I did a few things:

  1. Make sure the namespaces are consistent in the Designer.cs file of the resx file

  2. Make sure the default namespace of the Assembly(right click the project and choose Properties) is set the same to the namespace the resources file is in.

Once I did step 2, the exception went away.


I had this problem when I added another class in the file just before the class which derived from Form. Adding it after fixed the problem.


Just to mention. If you use a constant or literal, make sure it refers to a resource of the form ProjectName.Resources, and does not cpntain Resources.resx.

It could save you an hour or two .


The solution given by BlaM worked for me too.

I am a VS 2013 User. After going through many fixes but no luck, I tried this:

  1. Right-click the resource file, one-by-one, in case of multiple-files.
  2. Make sure, the property "Build Action" is set to "Embedded Resource".

That's it! :)


Also see: MissingManifestResourceException when running tests after building with MSBuild (.mresource has path in manifest)

I repeat the answer here just for completeness:

It appears adding LogicalName to the project file fixes it:

<LogicalName>$(RootNamespace).Properties.Resources.resources</LogicalName> 

i.e. so the embedded resource entry in the project file looks like this:

<ItemGroup>
  <EmbeddedResource Include="Properties\Resources.resx">
    <Generator>ResXFileCodeGenerator</Generator>
    <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    <LogicalName>$(RootNamespace).Properties.Resources.resources</LogicalName> 
  </EmbeddedResource>
</ItemGroup>

This is detailed in: http://blogs.msdn.com/b/msbuild/archive/2007/10/19/manifest-resource-names-changed-for-resources-files.aspx

Note that we are using a .resx file, but the bug still appears to occur.

Update: The problem with resources (incl. XAML) appears to be related to output paths and the use of forward or backward slashes as detailed in: Why does modifying project output directories cause: IOException was unhandled "Cannot locate resource 'app.xaml'."


I had the same problem, but using the Run Custom Tool command as suggested by Timwi did not help in my case.

However it lead me into the right direction, because I ended up in the Properties of the .resx file. Here I noticed a difference to another .resx file that caused no problems.

In my case I had to change the property "Build Action" from "Resource" to "Embedded Resource".

My best guess for the reason is, that I had the .resx in a library that was used from another application. My application did not have its own .resx file, so it had to use the one from the library - which is only available when it's embedded in the library and not "stand alone".


I've encountered this issue with managed C++ project based on WinForms after renaming global namespace (not manually, but with Rename tool of VS2017).

The solution is simple, but isn't mentioned elsewhere.

You have to change RootNamespace entry in vcxproj-file to match the C++ namespace.


From the Microsoft support page:

This problem occurs if you use a localized resource that exists in a satellite assembly that you created by using a .resources file that has an inappropriate file name. This problem typically occurs if you manually create a satellite assembly.

To work around this problem, specify the file name of the .resources file when you run Resgen.exe. While you specify the file name of the .resources file, make sure that the file name starts with the namespace name of your application. For example, run the following command at the Microsoft Visual Studio .NET command prompt to create a .resources file that has the namespace name of your application at the beginning of the file name:

Resgen strings.CultureIdentifier.resx 
MyApp.strings.CultureIdentifier.resources

I had the same issue, but in my case i places a class in a usercontrol which is related to the usercontrol like this

Public Class MyUserControlObject

end Class

Public Class MyUserCOntrol

end Class

The solution was to move the MyUserControlObject to the end of the Usercontrol class, like this

Public Class MyUserCOntrol

end Class

Public Class MyUserControlObject

end Class

I hope this helps


In my case, I have a web api with resources and I create a nuget package from that. When I use this nuget in other projects, I realise that when I request a api with resources, I am getting MissingManifestResourceException after a bit reasearch, I learn nuget packager is not packing resources automatically. If you want to use resources files, you have to do that manually. So you need to add below lines to your .nuspec file: (Visit https://github.com/NuGet/Home/issues/1482)

<package> 
    <metadata>
    </metadata>
    <files>
        <file src="bin\Debug\en\MyAssembly.resource.dll" target="lib\net40\en\MyAssembly.resource.dll" />
        <file src="bin\Debug\es\MyAssembly.resource.dll" target="lib\net40\es\MyAssembly.resource.dll" />
    </files>
</package>

But, before adding files, you need to be sure which version of .net you are using.


Also the same error may occur when you put a new class into the source code of a designer created form's class.

This new class may be removed, and placed in a different cs file.

(At least in my case this was the problem...)


Because I am pre-compiling my web application (using VS2012 publish feature). I was getting the error above. I tried all the suggestions, but weirdly changing 'Build Action' to 'Content' did the trick!


I've run into a similar issue and, although I know it isn't the cause the OP had, I'll post it here so that if someone else runs across this problem in the future an answer will be available.

If you add a class before the designer class you will get a MissingManifestResourceException exception at runtime (no compile time error or warning) because

Visual Studio requires that designers use the first class in the file.

For (slightly) more information see this post.


I had the with a newly created F# project. The solution was to uncheck "Use standard resource names" in the project properties -> Application -> Resources / Specify how application resources will be managed. If you do not see the checkbox then update your Visual Studio! I have 15.6.7 installed. In 15.3.2 this checkbox is not there.


I was getting the MissingManifestResourceException error after I ported my project from VS2005 to VS2010. I didn't have any other classes defined in the file that contains my Form class. And I also had my resx Resource File Name set correctly. Didn't work.

So I deleted the resx files and regenerated them. All good now.


When I run in a similar issue, in Vs 2012, it turned out that the "Custom Tool Namespace" property of the resx file was wrong (in my case, actually, it was unset, so the generated code yeld this exception at runtime). My final set of properties for the resx file was something like this:

  • Build action: Embedded Resource
  • Copy to Output Directory: Do not copy
  • Custom Tool: ResXFileCodeGenerator
  • Custom Tool Namespace: My.Project.S.Proper.Namespace

Recently ran into the same problem, struggled for a bit, found this topic but no answers were correct for me.

My issue was that when I removed main window from my WPF project (it does not have a main window), I forgot to remove StartupUri from App.xaml. I guess this exception can happen if you have a mistake in StartupUri, so in case if anybody is struggling with this - check your StartupUri in App.xaml.


Examples related to c#

How can I convert this one line of ActionScript to C#? Microsoft Advertising SDK doesn't deliverer ads How to use a global array in C#? How to correctly write async method? C# - insert values from file into two arrays Uploading into folder in FTP? Are these methods thread safe? dotnet ef not found in .NET Core 3 HTTP Error 500.30 - ANCM In-Process Start Failure Best way to "push" into C# array

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 resources

Spring Boot access static resources missing scr/main/resources How do I add a resources folder to my Java project in Eclipse Tomcat 8 throwing - org.apache.catalina.webresources.Cache.getResource Unable to add the resource Reading a resource file from within jar How to fix the "508 Resource Limit is reached" error in WordPress? How to get absolute path to file in /resources folder of your project getResourceAsStream returns null How to read file from res/raw by name Load image from resources Resource leak: 'in' is never closed

Examples related to manifest

Maven Error: Could not find or load main class Apply a theme to an activity in Android? Reference jars inside a jar Can't execute jar- file: "no main manifest attribute" How do I create/edit a Manifest file? How to setup Main class in manifest file in jar produced by NetBeans project Why has it failed to load main-class manifest attribute from a JAR file? What does MissingManifestResourceException mean and how to fix it? Command line tool to dump Windows DLL version?

Examples related to culture

Set Culture in an ASP.Net MVC app What does MissingManifestResourceException mean and how to fix it?