Thanks alot Pavel much appriciated
below is some test code , i know its not perfect just testing stuff
AssemblyName AsmName = new AssemblyName();
AsmName.Name = "cstest";
AsmName.CodeBase = @"d:\cstest";
AppDomainSetup DomainSetup = new AppDomainSetup();
DomainSetup.ApplicationBase =
AppDomain.CurrentDomain.BaseDirectory; // "d:\\cstest";
DomainSetup.DisallowApplicationBaseProbing = false;
DomainSetup.PrivateBinPath = DomainSetup.ApplicationBase
+ ";d:\\cstest;" + DomainSetup.ApplicationBase + "\\scripts";
DomainSetup.ApplicationName = AsmName.FullName;
AppDomain newDomain = AppDomain.CreateDomain("myDomain",
null, DomainSetup);
Assembly asm = null;
bool bStatic = true;
asm = LoadAssembly(ref newDomain);
System.Type MyType = asm.GetType("TestScript.Program");
object[] Params = new object[1] { "hello world" };
if (bStatic == false)
{
MyType = asm.GetType("TestScript.StringTest");
MethodInfo Mi = MyType.GetMethod("SayString");
//MyType=Mi.GetType();
Object o = Activator.CreateInstance(MyType);
Mi.Invoke(o, Params);
}
else
{
MyType = asm.GetType("TestScript.Program");
MyType.InvokeMember("Main",
BindingFlags.InvokeMethod, null, null, new object[0]);
}
AppDomain.Unload(newDomain);
Console.WriteLine("domain Unloaded");
}
catch (Exception ex)
{
NetTools.dvErrorSysWin.ShowError(ex);
}
}
public static Assembly LoadAssembly(ref AppDomain oDomain)
{
//havent been able to load from other folders other than the
Host Exe folder
//but still being loaded into the Appdomain not the
SecondaryDomain
//i'll keep working at it
Assembly asm = null;
System.IO.File.Copy("D:\\cstest\\csTest.dll","d:\\bin\\cstest.dll",true);
try
{
asm = oDomain.Load("cstest");
}
catch( Exception ex)
{
NetTools.dvErrorSysWin.ShowError(ex);
}
return asm;
}
}
}
Thats what im having Problems with....
Most Examples ive found , there all loading into the
current Domain....
ive used mySecondDomain.Load(DllName) -> failes when not AppDomain folder
or
gac
also ive used byets[] i get the same file not found error
AppDomain.Load(), just like Assembly.Load(), doesn't take a file name
as an argument. It takes a strong assembly name as an argument.
However, you can still initiate a call Assembly.LoadFrom - which does
what you want - from the first appdomain, but within the second
appdomain, via AppDomain.DoCallBack. E.g.:
AppDomain other = ...;
other.DoCallBack(
delegate
{
Assembly.LoadFrom("C:\\foobar.dll");
...
});
Now, most likely you need to do more than to just load assembly in
another domain - like, say, using it by instantiating types and
calling methods

In this case, use serializable types and
MarshalByRefObject-derived classes as needed to pass data back and
forth. If you have any _specific_ questions regarding the latter, then
you are welcome to ask - but please be specific with what exactly
you're trying to achieve.