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:
If someone could help me that would be greatly appreciated.
/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:
Code:
public Plugin(IServer host, string domainName, string filePath)
{
AppDomainSetup setup = AppDomain.CurrentDomain.SetupInformation;
setup.PrivateBinPath = "Plugins";
pluginDomain = AppDomain.CreateDomain(domainName, null, setup);
Assembly plugin = pluginDomain.Load(domainName); //Throws the error
Comment