It is not so simple as you think and if Visualstudio says that the reference is loaded it means that the references of the project is loaded during build. It has nothing to do with what you are tring to achieve.
the easiest way is to bind to AppDomain.AssemblyResolve Event that is called when the resolution of an assembly fails:
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.AssemblyResolve += new ResolveEventHandler(MyResolveEventHandler);
then:
private Assembly MyResolveEventHandler(object sender,ResolveEventArgs args)
{
Assembly rtn=null;
//Check for the assembly names that have raised the "AssemblyResolve" event.
if(args.Name=="YOUR RESOURCE ASSEMBLY NAME")
{
//load from resource
Stream resxStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("YOUR RESOURCE ASSEMBLY NAME");
byte[] buffer = new byte[resxStream.Length];
resxStream.Read(buffer, 0, resxStream.Length);
rtn = Assembly.Load(buffer);
}
return rtn;
}