I have been trying to download a program off of a website and then run said program. When I run it I get the following exception. I am new to C# so please use simple language.
System.ComponentModel.Win32Exception: 'The process cannot access the file because it is being used by another process'
No other process is using this program and should run fine.
if (restart == "1")
{
wc.DownloadFileCompleted += new
AsyncCompletedEventHandler(FileDowloadComplete);
Uri imageurl = new Uri(Website);
System.Threading.Thread.Sleep(1000);
wc.DownloadFileAsync(imageurl, "Example.exe");
System.Threading.Thread.Sleep(1000);
System.Diagnostics.Process.Start("Example.exe");
System.Threading.Thread.Sleep(1000);
}
The download works fine and the program will run if I comment out wc.DownloadFileAsync(imageurl, "Example.exe");