Hi,I'm getting a "assembly or one of its dependancies could not be found"
error when running the code below.The code works fine when called by a .NET
program, but fails when called by an assembly instantiated in Excel 2000.
The CreateInstanceF romAndUnwrap looks for the assembly in Excel's "Default
file location" setting, even though the correct path is set by
setup.Applicati onBase.
What am I doing wrong?
Thanks.Francis Gingras
// Get reflection permission
ReflectionPermi ssion reflectionPerm = new
ReflectionPermi ssion(Permissio nState.None);
reflectionPerm. Flags = ReflectionPermi ssionFlag.Membe rAccess;
// Get file permissions
FileIOPermissio n fileperm = new FileIOPermissio n(FileIOPermiss ionAccess.Read
| FileIOPermissio nAccess.PathDis covery,
Path.GetDirecto ryName(Assembly .GetExecutingAs sembly().Locati on));
fileperm.Assert ();
AppDomainSetup setup = new AppDomainSetup( );
setup.Applicati onBase =
Path.GetDirecto ryName(Assembly .GetExecutingAs sembly().Locati on);
Evidence evidence = AppDomain.Curre ntDomain.Eviden ce;
adapterDomain = AppDomain.Creat eDomain("MyApp. Adapter", evidence, setup);
ILoader loader = (ILoader)
adapterDomain.C reateInstanceFr omAndUnwrap("c: \bin\MyApp.dll" ,
"MyApp.Loader") ;