Is there a way to persist CS-Script internal assembly cache between subsequent application's runs?
Used component: http://www.csscript.net/
The desired behavior is: when I compile an assembly form a script string and I close the application, the next time I run the application the compiled assembly with matching script string is found and no recompilation is needed.
This question is follow-up of another question: Is there a way to call C# script files with better performance results?
Here is my code, but every script string requires recompilation with every restart of parent .NET application.
public interface ICalculateScript
{
Exception Calculate(QSift qsift, QSExamParams exam);
}
...
void Calculate(string script)
{
CSScript.CacheEnabled = true;
//Can following command use built-in cache to load assembly, compiled by this line of code, but by another instance of this app which run in the past and has been meanwhile closed?
Assembly assembly = = CSScript.LoadCode(script, null);
AsmHelper asmHelper = new AsmHelper(assembly);
ICalculateScript calcScript = (ICalculateScript)asmHelper.CreateObject("Script");
calcScript.Calculate(this, exam);
}
Related problem: The folder of temp scripts created by Cache in CS Script C:\Users\vdohnal\AppData\Local\Temp\CSSCRIPT\Cache\2015108000 has 41 MB and growing with files few months old.
In the output window of WPF App there are first chance exceptions: A first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll A first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll A first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll A first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll A first chance exception of type 'System.IO.FileLoadException' occurred in mscorlib.dll 'ESClient.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\vdohnal\AppData\Local\Temp\CSSCRIPT\Cache\2015108000\af621e10-d711-40d7-9b77-0a8e7de28831.tmp.compiled' C:\Users\vdohnal\AppData\Local\Temp\CSSCRIPT\Cache\2015108000