I am trying to dynamically load an assembly that has a reference to
'Interop.WMEncoderLib.dll' which is a PIA to the windows media player DRM
components. When I run the code from a console application it works
perfectly fine, but when the assembly containing the reference is load from
a windows service an exception is thrown with the following message:
"File or assembly name Interop.WMEncoderLib, or one of its dependencies, was
not found."
Now I am guessing this is because the windows service runs under the
location of 'windows root\system32' not where there service execute is
installed. The assemblies I am loading at runtime resides in a sub directory
(with all the dll's referenced by the assembly) and are designed as a
plugable architecture that returns an interface to the caller.
public static IIngestor CreateInstance(string assemblyName, string
classType, object[] args)
{
Assembly loadedAssembly = Assembly.LoadFrom(assemblyName);
IIngestor ingestor = (IIngestor)loadedAssembly.CreateInstance(classType ,
true, BindingFlags.Default, null, args, null, null);
if(ingestor == null)
throw new System.ArgumentException("Failed to create ingestor
invalid assembly or class name, assembly = '" + assemblyName + "', class
name ='" + classType + "'.");
return ingestor;
}
Can anyone help me out here
Cheers
Ollie Riches