
When a package is remove in some instance the system complains that a file still exists in the deleting directory but there is not file. Added true parameter to the Directory delete for force the removal. Directory.Delete(Path.GetDirectoryName(filepath), true);