title: C# Delete DLL file with full permission get Unauthorized exception
body: <p>I'm trying to delete all file from <code>destBackUpFolder</code>, the result is all files are deleted from the folder <strong>except 1 dll file</strong>, I get a <strong>Unauthorized Exception</strong> said that <strong>access to the dll file is denied</strong>. I have tried suggestion from web by setting the file attribute to normal and delete file by file, check my permission and make sure my permission is allowed to delete file but all those method doesn't work, Why am I getting unauthorized exception even my permission is set to full control? FYI, I am using <strong>Team Foundation Server</strong> for my development version control, Is the problem here related to my TFS? Thanks in advance.</p>
  
  <pre><code>try
  {
      DirectoryInfo folderToBeDelete = new DirectoryInfo(destBackUpFolder);
      folderToBeDelete.Delete(true);
  
      if (Directory.Exists(backupFolder))
      {
          Directory.CreateDirectory(destBackUpFolder);
          result = CopyFileAndFolder(backupFolder, destBackUpFolder);
  
          if (result)
          {
              ErrorMsg = "Copy process Failed,Your File has rolled back to previous version";
              IsErrorDetected = true;
          }
      }
  }
  catch (Exception)
  {
      ErrorMsg = "Error during roll up process";
      IsErrorDetected = true;
  }
      //block of code where i trying to get my version number of the dll 
        Assembly _assembly = Assembly.LoadFrom(ConfigurationManager.AppSettings["DllPathForBackUp"]);
          Version versionNumber = _assembly.GetName().Version;
          completeVersionNumber = versionNumber.Major + "." + versionNumber.Minor + "." + versionNumber.Build + "." + versionNumber.Revision;   
  </code></pre>