I think this problem seems a lot to be questioned, but I still haven't found a solution.
I want to update my application by comparing dll.
file version. I already got the file version, but when I want to update it, it gives me this error.
the code
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo(@"D:\Projects\Sample\bin\Debug\Sample.dll");
FileVersionInfo myFileVersionInfo2 = FileVersionInfo.GetVersionInfo(@"C:\Projects\Sample\bin\Debug\Sample.dll");
MessageBox.Show("Version number this: " + myFileVersionInfo.FileVersion);
MessageBox.Show("Version number 2: " + myFileVersionInfo2.FileVersion);
if (myFileVersionInfo.FileVersion != myFileVersionInfo2.FileVersion)
{
string file = "Sample.dll";
string source = @"D:\Projects\Sample\MainSystem\bin\Debug\";
string target = Application.StartupPath;//@C:\
string sourceFile = System.IO.Path.Combine(source, file);
string destFile = System.IO.Path.Combine(target, file);
System.IO.File.Copy(sourceFile, destFile, true); //<< error
{
the code run when I open the application and click button
the Error
System.IO.IOException: The process cannot access the file 'C:\Projects\Sample\bin\Debug\Sample.dll' because it is being used by another process.