468,769 Members | 1,978 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,769 developers. It's quick & easy.

Cannot load assemblies in sub-directories

Ok so I am making plugins for my application and I have the plugins located in a subdirectory:

/AppDir
/AppDir/Plugins

All my plugins reference a Plugins interface file, which is also located in the Plugins subdirectory. I used AppDomainSetup.PrivateBinPath property to have it probe the subdirectory, but when I try to load it into my AppDomain it throws an error:

Could not load file or assembly 'EmptyPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

Which makes me think it can't find the file but when I comment out the PrivateBinPath property it throws me this error instead:

Could not load file or assembly 'EmptyPlugin' or one of its dependencies. The system cannot find the file specified.

So that tells me that it finds the file. When I view the detail of the first error it shows me this:

Source: mscorlib

So the only thing I can think is it can't load mscorlib. But mscorlib is in the GAC so I don't know how it couldn't load. Anyway, heres the code thats throwing the error:

Expand|Select|Wrap|Line Numbers
  1. public Plugin(IServer host, string domainName, string filePath)
  2.         {
  3.             AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;
  4.             setup.PrivateBinPath = "Plugins";
  5.             pluginDomain = AppDomain.CreateDomain(domainName, null, setup);
  6.             Assembly plugin = pluginDomain.Load(domainName); //Throws the error
If someone could help me that would be greatly appreciated.
Apr 2 '08 #1
1 1983
I forgot to say that it is coded in C#
Apr 3 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by David C. allen | last post: by
5 posts views Thread by Rudolf Ball | last post: by
1 post views Thread by Chriss | last post: by
1 post views Thread by Dominique Vandensteen | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.