Searching for Assembly Files
Activation contexts can help the loader find assembly files. When the loader searches for a file to load by name, it first searches for files with the specified name that are referenced by assemblies that are members of the currently active activation context. A call to SearchPath also locates these files first. Files having the specified name and the current activation context are found and loaded before files with the name in the local directory or in the PATH environment variable. This means that when you create manifests you need to list all files you plan to use with SearchPath, LoadLibrary, or static imports.
Note that these files are not automatically located when using CreateFile or other functions that do not search for files. To use these files with CreateFile, use SearchPath first to find the path to the isolated file, and then use CreateFile on the returned path.
This method of file searching helps to keep isolated applications separate because multiple files with the same name can then differ only by their association with assemblies of different version numbers. The operating system can find the correct file to use during file operations.
If a DLL is loaded in this manner using LoadLibrary, that DLL's entry point (DllMain) is called while the original activation context is kept active, except if the DLL itself contains a manifest at a certain resource ID (ISOLATIONAWARE_MANIFEST_RESOURCE_ID, or 2)