This is how the temp file is created and as you can see it is not possible to predict the file name and it's location:
string tempFile = CSExecutor.GetScriptTempFile();
try
{
using (StreamWriter sw = new StreamWriter(tempFile))
{
sw.Write(scriptText);
}
return Compile(tempFile, assemblyFile, debugBuild, refAssemblies);
...
static public string GetScriptTempFile()
{
lock (typeof(CSExecutor))
{
return Path.Combine(GetScriptTempDir(), Guid.NewGuid().ToString() + ".tmp");
}
}However you do not have to use CompileCode(). You can save the code to any location of your choice and then call Compile(). So you have full control over the source code file naming and the location.