f# - Load a resource from an assembly without locking the dll file -


I am trying to load the resource from an assembly without locking the dll file.

The meter is trying the following, which is similar to something that I used earlier in C #:

  type IEmbeddedResourceReader = Abstract ReadResource: referencedAssemblies: string [] * AsmName: string * ResourceName: string - & gt; String Option Type EmbeddedResourceReader () = MarshalByRefObject (with member) Interface IEmbeddedResourceReader Heres __ ReadResource (referencedAssemblies, asmName, ResourceName) = try asmLocation = referencedAssemblies Go | & Gt; Array.tryFind (Fun (X: String) -> gt; EndsWith (asmName + ".dll", String Communications, Inventory Culture Ignore Seas)) asm = Match with ASM Allocation. Some asmLocation - & gt; No assembly - & gt; Assembly.Load (asmName) sr = Use new streamrider (asm.GetManifestResourceStream (resourceName)) (sr.ReadToEnd ()) with _ - & gt; Any static member rersers (referenced problems, resource names: string) = match resource name. With split (','). [| AsmName; Name |] - & gt; ? Domain = AppDomain.CreateDomain "Embedded Resource Reader" Let's reader = domain.CreateInstanceFromAndUnwrap (;; EmbeddedResourceReader & gt; FULLName Assembly.GetExecutingAssembly () location, typeof & lt): & gt; IEmbeddedResourceReader Reader. Readersource (referenced problems, asmName.Trim (), name.Trim ()) Finally AppDomain.Unload Domain | _ - & gt; Anyone  

but I'm getting an invalidcache exception (unable to enter a transparent proxy for typing 'IEmbeddedResourceReader.')

What am I doing?

I need to add it to turn it on:

  Stabilize AppDomain CurrentDomain.add_AssemblyResolve (ResolveEventHandler (Fun _ Arg -> if args.Name = typeof & gt; IEmbeddedResourceReader & gt; .Assembly.FullName then typeof & lt; IEmbeddedResourceReader & gt ;.Assembly rest tap))  

thanks for the reply @ mitekm (Dmitry Morozov)

Unfortunatelly, DLL is no longer closed, but XML and PDB files are still blocked by VS: /


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -