Testing code in GAC with NUnit

less than 1 minute read

I often run test codes that reference methods of business class and the class is compiled and stored in GAC. Sometimes, I update the method but NUnit keeps running the old code. What I did was

  • Visual Studio's Clean (this deletes all assemblies under the test project)
  • reset iis. this is supposed to flush GAC
  • rebuild the business class.

But still it did not work. I slept on it and the next morning, I remembered I didn't restart NUnit and NUnit might hold the old assembly in its own memory. I closed NUnit and opened it, and the new method was loaded. Fantastic.

So, when you changed your method but can't see it working, restart NUnit!

Added in 3 days later

To ensure NUnit loads the newly compile dll, please do

  • Rebuild the whole solution of your GAC code
  • Clean adn rebuild your testing code
  • Close NUnit and start it again.