I am running an external process in a custom msbuild task. This task is in assembly A which is called when I'm building project B. Everything works fine. However, when trying to clean the project. Visual Studio 2008 gives me an error saying "the process cannot access assembly A because it is being used by another process". Restarting Visual Studio fixes this problem.
The code calling the external process is as follows
Process process = new Process();
process.StartInfo = new ProcessStartInfo { FileName = @"c:\program.exe", Arguments = "", UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true, RedirectStandardError = true };
process.Start();
process.WaitForExit(5000);
How do I troubleshoot a problem like that?
Update: Using Process Explorer, it tells me devenv.exe has a handle on assembly A. Why and how do I stop it from having a handle on it?