S
Sebastien Girard
Hi everyone,
I am trying to load a shared assembly in it's own application domain. I
created a simple Windows Application with 1 button that executes the code
below. It is trying to load a very simple assembly 'ClassLibrary1' that is
located in the GAC.
The call to CreateInstanceAndUnwrap is unable to locate the assembly. I
have no clue as to why the application domain can't load a shared assembly,
any help is welcome.
// Prepare Setup
AppDomainSetup appDomainSetup = new AppDomainSetup();
appDomainSetup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
appDomainSetup.ApplicationName = "MyAppDomainName";
// Create Application domain
AppDomain myAppDomain = AppDomain.CreateDomain("MyAppDomainName", null,
appDomainSetup);
try
{
// Load shared assembly
myAppDomain.CreateInstanceAndUnwrap("ClassLibrary1",
"ClassLibrary1.Class1");
}
catch(Exception ex)
{
// Crashes with message "File or assembly name ClassLibrary1, or one of
it's dependencices was not found."
MessageBox.Show(ex.Message);
}
I am trying to load a shared assembly in it's own application domain. I
created a simple Windows Application with 1 button that executes the code
below. It is trying to load a very simple assembly 'ClassLibrary1' that is
located in the GAC.
The call to CreateInstanceAndUnwrap is unable to locate the assembly. I
have no clue as to why the application domain can't load a shared assembly,
any help is welcome.
// Prepare Setup
AppDomainSetup appDomainSetup = new AppDomainSetup();
appDomainSetup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
appDomainSetup.ApplicationName = "MyAppDomainName";
// Create Application domain
AppDomain myAppDomain = AppDomain.CreateDomain("MyAppDomainName", null,
appDomainSetup);
try
{
// Load shared assembly
myAppDomain.CreateInstanceAndUnwrap("ClassLibrary1",
"ClassLibrary1.Class1");
}
catch(Exception ex)
{
// Crashes with message "File or assembly name ClassLibrary1, or one of
it's dependencices was not found."
MessageBox.Show(ex.Message);
}