Often you run into the file copy issue (“the file is in use by another process”). Sometimes it is evident who is the active process using your file, other times it can be a little complicated to determine who is indeed holding on to your file you are trying to copy from or to.
Well – to determine this in a quite robust way; you have the luxury of using ‘ProcesExplorer’ by SysInternals. Follow this recipe to see how to determine the exact process (PID) holding on to your assembly.
I want to copy an assembly (FIMLoggingActivityLibrary.dll) like this:
Development machine –> Test machine
But, when I attempt this, I’m presented with the below dialogs:
I know the name of the assembly I want to replace (FIMLoggingActivityLibrary.dll), so armed with this knowledge, I can use ProcessExplorer to find the hosting process:
Press ‘Find’ – ‘Find Handle or Dll…’
next – enter the known part of the file name you want to search for:
Here you have the name and ProcessID (PID) of the process holding on to your file. Now, either shut the process down in a nice fashion (in the above case using Control Panel – Services) or in a rude manner using Process Kill from Task Manager. This really depends on the situation what you do here.
When this process is stopped or restarted, you are able to copy the file initially requested.