0

So I have NGENed one assembly and but it is not being used by runtime, because at runtime current application directory is changed like Directory.SetCurrentDirectory(requiredDirectory) so Ngen assembly is not being used by runtime.
How are we loading assembly:

IModuleManager.LoadModule(localWi.ModuleName);

We are using WPF PRISM IModuleManager to load the assembly at the rum time. But before this have to change the current application directory as shown above. So we do all the above things then Ngen assemblies are not being used. Any idea how we can do that?

Kamal Kr
  • 687
  • 1
  • 10
  • 22

1 Answers1

0

It involves two elements.

  • Assembly.LoadFrom does not reliably load NGEN images,

http://blogs.msdn.com/b/abhinaba/archive/2014/02/18/net-ngen-explicit-loads-and-load-context-promotion.aspx

  • IModuleManager.LoadModule in fact depends on Assembly.LoadFrom if you carefully analyze PRISM source code,

http://compositewpf.codeplex.com/SourceControl/latest#V4/PrismLibrary/Desktop/Prism/Modularity/AssemblyResolver.Desktop.cs

Lex Li
  • 60,503
  • 9
  • 116
  • 147
  • yes. Prism uses LoadFrom and so Ngen image is not getting loaded. I was looking at any alternative way through code or configuration (but not by proving proving privatePath) but found none. – Kamal Kr Mar 10 '14 at 12:31