7
votes

I am using the built in TeamCity NUnit runner to run tests stored in .DLL files.

My .DLLs are referencing other DLLs which are present in the same folder.

When running these, i am getting a FileNotFoundException for the referenced DLLs.

How can i fix this? I am thinking perhaps the TC NUnit runner is using some other dir as the main app execution folder, and thus preventing from files that are actually residing next to the test DLL to not load properly, but cannot prove this claim yet...

Anyone else encountered this behaviour?

3

3 Answers

9
votes

OK the problem is solved and it is indeed silly and embarrassing:

I have set the NUnit test runner to execute these tests:

**/*.Tests.dll

This means that it will include tests from /bin/Debug/ and also from other folders, such as obj/

In these folders, no references are included of course, making the same tests run twice and some of these fail of course!

1
votes

Paths are related to build checkout directory, not to any working directory. If you need another paths, use %reference% syntax to refer to TeamCity property with a directory path. Do you run it under Windows? Do you use TeamCity 6.5?

If that does not help, feed free to contact [email protected]

0
votes

In my case, the missing DLL was a native library and it could not be loaded because there was an incorrect version of VC runtime installed on the build agent. My solution was to add runtime DLLs (located in 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\redist\x86\Microsoft.VC110.CRT') directly into the project (build action = Content, copy to output directory = Copy always). This also makes installation friendlier.

Hope this helps.