In the .NET Compact Framework 3.5 application, I perform version checking in a rather narrow cycle to find out if another assembly needs to be updated (have a new copy in another directory copied above it, then run it again).
The problem is that it Assembly.LoadFrom(path).GetName().Versionlocks the file and prevents the specified copying.
AssemblyName.GetAssemblyName(path)it would be the best way to get this (thanks to this SO answer ), since it does not constantly load the assembly into AppDomain and thus does not block the file, but it is not available in the Compact Framework.
I could create a new one AppDomain, but I cannot use a new method Loadthat is not supported in the Compact Framework.
As a last resort, I decided that I would allow the assembly to really boot with overload Assembly.Load(byte[]), which would lead to a "leak" of massive memory in a narrow cycle, since they were never unloaded. To counter the fact that I intended to first hash the array of assembly bytes and check the version cache for the previous hit. However, as you might have guessed, byte array overloading is Assembly.Load()not supported in the Compact Framework.
I also considered adding AssemblyFileVersions, as they are easier to check anyway, but this is one more thing in the growing heap of things that are not supported in the Compact Framework (thanks to this SO answer , so as not to try this).
Please tell me what I'm trying to do, so that I stop hating this structure so much?