Answered by:

Could not load file or assembly

Question

I get the following warning while loading my assembly which is in a folder inside my root folder

The assembly named 'SmartTrade.Plugins.RedCoal' was loaded from 'file:///C:/VSS2005/v3.2/SmartTrade_Set2/SmartTrade_DevBuild/Plugins/SMS/SmartTrade.Plugins.RedCoal.dll' using the LoadFrom context. The use of this context can result in unexpected behavior for serialization, casting and dependency resolution. In almost all cases, it is recommended that the LoadFrom context be avoided. This can be done by installing assemblies in the Global Assembly Cache or in the ApplicationBase directory and using Assembly.Load when explicitly loading assemblies.

Later methods in this assembly as called and one of the methods creates in instances of a class which is in another dll in the same subfolder and this causes the following error:

The assembly with display name 'Interop.RedcoalMessaging' failed to load in the 'Anonymous' binding context of the AppDomain with ID 1. The cause of the failure was: System.IO.FileNotFoundException: Could not load file or assembly 'Interop.RedcoalMessaging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.File name: 'Interop.RedcoalMessaging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'