I just discovered a fun tidbit of information. I was using NUnit to test a number of assemblies in a single project, and many functions need an app.config file. The instructions on how to do this can be found in various places, but I was having a problem that nobody else seemed to have.
My config file looked like this:
<!– config values for nunit –>
<?xml version=”1.0″ encoding=”utf-8″ ?>
Â Â Â <appSettings>
Â Â Â Â Â Â <add key=”…” value=”……” />
Â Â Â </appSettings>
Â Â Â Â
Â Â Â Â
Â Â Â
Every time NUnit started up that project, it would fail with an assembly load error:
System.IO.FileNotFoundException : File or assembly name nunit.core, or one of its dependencies, was not found.
For further information, use the Exception Details menu item.
My first thought to that was “Huh?!” It was a highly annoying problem, because I thought I was following the instructions exactly and it should have worked!
Do you see the problem? It’s this line:
< ?xml version="1.0" encoding="utf-8" ?>
It needs to be the first line in the file (or taken out completely). Voila, everything works.
Check out my latest book, the essential, in-depth guide to performance for all .NET developers:
Writing High-Performance.NET Code, 2nd Edition by Ben Watson. Available for pre-order: