Wednesday, September 19, 2012

mstest and localization hell

I have a project which have some localized resources in a dll. My test won't pass because for some reason it can't find the resource. Funny thing is if I create another project with the same code, test works. And it turned out someone added Test Settings and it set to deploy. So Visual studio copies everything to a TestResult directory, but forget to copy the localization dlls :-) Just that stupid thing alone took me a long time to figure out. Then the test fails on the build server. The only difference is on build server it run under mstest.exe. I tried it on my machine, also not working if invoked with mstest.exe. So did some online search and a parameter /noisolation needs to be added to mstest.exe for it to work. Some more digging and the real solution is to add [DeploymentItem(@"xx-YY\Resources.resources.dll", "xx-YY")] (where xx-YY is the locale code, i.e. en-US). Hope this can be of help to others.

No comments: