I'm working on a C# compact application with win CE platform and I am using this code .....
var assembly = Assembly.LoadFrom(assemblyFile);
Version ver = assembly.GetName().Version;
theVsertion = ver.ToString();
to get the file version but in another method, I must delete the old file, and when I try to use this code.
if (File.Exists(assemblyFile))
{
File.Delete(assemblyFile);
}
if found this error
" process cannot access the file ### because it is being used by another process."
please, anyone can help me with this issue.
The only way to unload an assembly is to unload the AppDomain. An alternative would be to read the file into a byte[] and load this byte[] as assembly.