With TFS Build 2010, I have build process running devenv.com for several projects. After that, I want all the binaries to be copied from the output folders with C# Custom Build Activities with "File.Copy". However, it threw me this exception with the first copy of the file:
The process cannot access the file 'C:\Test\BuildServer\Sources\Library\LibraryInstall\LibraryInstall\Release\LibraryInstall.msm' because it is being used by another process.
It seems the file is still been using by the devenv.com. Any idea how? Other than File.Copy, is there any better way to copy it regardless the file status?
======
I found an ugly way:
Process proc = new Process();
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.FileName = @"C:\WINDOWS\system32\xcopy.exe";
proc.StartInfo.Arguments = "/Y " + Path.Combine(sourcesDirectory, fileName) + " " + binariesDirectory;
proc.Start();