FileNotFoundException When Looking for YourAssembly.resources.dll? Here’s Your Fix!

I happened to be working on a C# Roslyn code analyzer and being cognizant that not all the world speaks English, I went through the five minutes of work to internationalize the analyzer DLL. Add the .RESX file and you’re pretty much done. All my unit tests ran perfectly as did the tests of running the analyzer as a .VSIX. However, when I ran the tests with the analyzer in a NuGet package, I kept getting the compiler crashing with a FileNotFoundException trying to load the <assemblyname>.resources.dll file. After spending several hours trying different attempts at working around the problem, it finally dawned on me, I had run into this same bug many, many years ago.

Even though you have the resources in the assembly, that’s not the default place .NET looks. To tell .NET to look in the assembly, you have to specify in your Assembly.CS file the following:

[assembly: NeutralResourcesLanguage(“en-US”)]

That’s all there is to it. Why .NET resource searching doesn’t always look in the assembly by default is beyond me. Now that the Core Framework is open sourced, maybe I should submit a patch!

John Robbins

View Comments

Recent Posts

8-Step AWS to Microsoft Azure Migration Strategy

Microsoft Azure and Amazon Web Services (AWS) are two of the most popular cloud platforms.…

3 days ago

How to Navigate Azure Governance

 Cloud management is difficult to do manually, especially if you work with multiple cloud…

1 week ago

Why Azure’s Scalability is Your Key to Business Growth & Efficiency

Azure’s scalable infrastructure is often cited as one of the primary reasons why it's the…

3 weeks ago

Unlocking the Power of AI in your Software Development Life Cycle (SDLC)

https://www.youtube.com/watch?v=wDzCN0d8SeA Watch our "Unlocking the Power of AI in your Software Development Life Cycle (SDLC)"…

1 month ago

The Role of FinOps in Accelerating Business Innovation

FinOps is a strategic approach to managing cloud costs. It combines financial management best practices…

1 month ago

Azure Kubernetes Security Best Practices

Using Kubernetes with Azure combines the power of Kubernetes container orchestration and the cloud capabilities…

2 months ago