By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,723 Members | 1,270 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,723 IT Pros & Developers. It's quick & easy.

Cannot load assemblies in sub-directories

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


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=, 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
Share this Question
Share on Google+
1 Reply

P: 3
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.