File in use by another process

mafrosis

Well-known member
Joined
Jun 5, 2006
Messages
88
Location
UK
Programming Experience
5-10
I had to write a tool for novice users to recompile a project and copy a DLL to a remote server. Basically, they use a handbook/guide to add new DataSet objects to a project and then use this tool to recompile and release an updated file. It's a bit too much power in the hands of novices if you ask me - but hey, thats whats they want.

My problem is that after compiling the file and copying it up to the server, running the application a second time fails with "The process cannot access the file <blah.dll> because iit is being used by another process."

Here's a slightly leaner version of my code:

VB.NET:
[COLOR=Green]'start compilation process[/COLOR]
[COLOR=Blue]Dim [/COLOR]p [COLOR=Blue]As New [/COLOR]Process()
p.StartInfo.FileName = CompilerPath
p.StartInfo.Arguments = [COLOR=DarkRed]"/Rebuild Release "[/COLOR] & <path_to_solution>
p.Start()

p.WaitForExit()

IO.File.Copy(BinPath & [COLOR=DarkRed]"PMDDAL.dll"[/COLOR], RemotePath & [COLOR=DarkRed]"PMDDAL.dll"[/COLOR], [COLOR=Blue]True[/COLOR])
Any ideas whats holding the file? Or a fix?

Cheers guys
 
Back
Top