Question

I have a Project Reference (to B.dll) in Asp.Net MVC project, which is not used statically. At startup I'm looking through the loaded assemblies and dynamically register types from them in the IoC container.

When I rebuild MVC project and hit F5 I see B.dll in the list of loaded assemblies returned by AppDomain.CurrentDomain.GetAssemblies().

Then I hit Stop and F5 again. This time there's no B.dll in the loaded assemblies. However, if I call AppDomain.CurrentDomain.Load("B") it'll be loaded correctly.

If I rebuild the project cycle repeats.

So the questions are:

  1. I assume, that dlls from bin folder should be loaded by IIS at startup, am I right?
  2. Why Visual Studio behavior on first and 2nd debug sessions different? And most importantly, how to force it to loaded all the libraries on startup?
Était-ce utile?

La solution

  1. Yes. At first time, when compilation occurs.
  2. Because those libraries will be loaded on demand, after they were compiled.

This should help How to pre-load all deployed assemblies for an AppDomain

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top