The line of code:
setup.PrivateBinPath = @"\,\Plugins";
does not appear correct. Each separate relative path should be delimited
with a semi-colon, not a comma, and the relative path "\" does nothing so
far as I can tell. Also, you do not need to pre-pend a leading backslash. I
think you could replace that LOC with this...
setup.PrivateBinPath = @"Plugins";
Also, if the only thing your loader does is specify a relative search path
you could more easily add a <probing> element (see my other reply) to you
app.config file and not need the loader at all.
"Benny Raymond" <be***@pocketrocks.com> wrote in message
news:ul**************@TK2MSFTNGP14.phx.gbl...
Since loading my plugins in a seperate domain wasn't sufficent for what my
app required, here's what I ended up doing. Please let me know if i'm
going about anything wrong. - Also, I can't figure out how to make my
plugins automatically compile into the plugins directory instead of the
main output one - please let me know if you know how to do this (right now
i'm using the post compile event)
I changed my main form so that it loads up as a stub executable, so my exe
ends up being really small and just consists of this:
namespace APPNAME
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(fals e);
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
setup.PrivateBinPath = @"\,\Plugins";
setup.ApplicationName = "APPNAME";
AppDomain appDom =
AppDomain.CreateDomain("APPNAME",null,setup);
appDom.CreateInstanceFromAndUnwrap("APPNAME.Contai ner.dll",
"APPNAME.Container.Program");
}
}
}
then, I start buliding my app as normal within the APPNAME.Container dll -
instead of your normal program.cs file it ends up looking something like
this:
namespace APPNAME.Container
{
[Serializable]
class Program
{
public Program()
{
Application.Run(new Form1());
}
}
}