public void Cleanup() { GC.Collect(); // Otherwise the nancy viewengine still keeps references to the files Directory.SetCurrentDirectory(_oldCurrentDir); Directory.Delete(_exportPath, true); Directory.Delete(_websitePath, true); }