Hi NG!
I have troubles with loading an application to its own app domain.
I have two applications: An caller application named
"OfficeTSWCallerDemo" (in a directory like
"X:\Blablabla\AppA\bin\Debug") and an callee application named
"GEMOfficeTSW" (in a directory like "X:\Gagaga\AppB\bin\Debug"). The
latter saves settings in its GEMOfficeTSW.exe.config and user.config in
C:\Documents and Settings\username\Local Settings\Application
Data\company\GEMOfficeTSW.vshost.exe_Url_da54u2y5p ojuhcg4ad2nf055bfg50kwr\0.9.0.0.
The problem is that if the caller applications loads the callee
application, the callee application cannot read and write settings
accordingly (for one date, always the defaut value is returned, for
another one it works). I suspected that this is a problem related to
the application domain. So I thought instead of calling the callee
application with
Assembly assGEMOTSW =
Assembly.LoadFrom(Path.Combine(strAssemblyDirector y,
"GEMOfficeTSW.exe"));
Type typeProgram = assGEMOTSW.GetType("AVL.GEM.GEMOfficeTSW.Program") ;
I do this with the creation of a new application domain, like below:
Environment.CurrentDirectory = strAssemblyDirectory;
AppDomainSetup info = new AppDomainSetup();
info.ApplicationBase = strAssemblyDirectory;
info.ApplicationName = "GEMOfficeTSW";
info.PrivateBinPath = strAssemblyDirectory;
info.ConfigurationFile = strAssemblyFilename + ".config";
AppDomain appDomain = AppDomain.CreateDomain("GemOTSWDomain", null,
info);
Assembly assGEMOTSW2 = appDomain.Load("GEMOfficeTSW");
If I run this code, I get an error in the line with
"AppDomain.CreateDomain":
Could not load file or assembly 'GEMOfficeTSW, Version=0.9.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The
system cannot find the file specified.
I don't have a clue what I made wrong. :-( I already googled a lot but
I could not find an appropriate solution.
Can anybode help me?
BR,
Michael