Question

I'm very new to unit testing in C#. I added a test project with Visual Studio, but when I try to run tests, they fail, complaining about assembly binding failures.

So I enabled logging and noticed that the tests are trying to load my DLLs from a culture-specific directory (one that doesn't exist).

E.g. if the test project's DLL exists in C:\MyProject\, it looks for the assembly under test in C:\MyProject\en-GB\.

The only reference anywhere to en-GB is the assembly culture attribute of the assembly under test. If I change that attribute's value to say, en-US, the unit test binder searches for the DLL in /en-US/

Can I somehow specify that I do not want this behaviour?

Was it helpful?

Solution

from the documentation,

The attribute is used by compilers to distinguish between a main assembly and a satellite assembly. A main assembly contains code and the neutral culture's resources. A satellite assembly contains only resources for a particular culture, as in [assembly:AssemblyCultureAttribute("de")]. Putting this attribute on an assembly and using something other than the empty string ("") for the culture name will make this assembly look like a satellite assembly, rather than a main assembly that contains executable code. Labeling a traditional code library with this attribute will break it, because no other code will be able to find the library's entry points at runtime.

so basically, don't use that attribute. are you actually testing a localized satellite assembly?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top