Specify app.config file for new AppDomain

71 views
Skip to first unread message

mark....@gmail.com

unread,
May 4, 2012, 3:46:01 PM5/4/12
to cs-s...@googlegroups.com
I am using the following code to compile a script and load it into a new AppDomain:

asmName = CSScript.Compile(scriptFile, asms);
mAsmHelper = new AsmHelper(asmName, asmName, true);

I need to be able to specify the app.config file for the new AppDomain because it does not seem to use the one from the .exe.

How can I get the new assembly in the new AppDomain to use a app.config file?

Thanks,
Mark

Oleg Shilo

unread,
May 4, 2012, 10:15:48 PM5/4/12
to cs-s...@googlegroups.com
Hi Mark,

I have just tested and the primary config file (of the *.exe) gets loaded in the script execution domain.  The code sample for you can be found here: http://dl.dropbox.com/u/2192462/Support/Mark%20Lynne/Mark%20Lynne.7z

As for the custom (not from the .exe) config file, you will need to load it explicitly in the script or create the new AppDomain by yourself and then use Clone() extension to execute the script. See this page for ideas: http://www.csscript.net/help/Script_hosting_guideline_.html#_remote_vs_local

Cheers,
Oleg Shilo
--------------------------------------------------------------------------------------------
Internet: http://www.csscript.net
E-Mail: csscript...@gmail.com

mark....@gmail.com

unread,
May 7, 2012, 12:12:44 PM5/7/12
to cs-s...@googlegroups.com
Hi Oleg,

You are correct. Your example worked as you said in my application as well. Thank you for your help.

Mark
Reply all
Reply to author
Forward
0 new messages