// we need to use CompileEngine (which is slower but supports multiple file compilation
 public void compileExtraSourceCodeReferencesAndUpdateReferencedAssemblies()
 {
     if (ExtraSourceCodeFilesToCompile.size() > 0)
     {
         var assembly = new CompileEngine().compileSourceFiles(ExtraSourceCodeFilesToCompile);
         if (assembly != null)
         {
             ReferencedAssemblies.Add(assembly.Location);
             generateDebugSymbols = true;                // if there are extra assemblies we can't generate the assembly in memory
         }
     }
 }
 // we need to use CompileEngine (which is slower but supports multiple file compilation
 public void compileExtraSourceCodeReferencesAndUpdateReferencedAssemblies()
 {
     if (ExtraSourceCodeFilesToCompile.size() > 0)
     {
         "[CSharp Compiler] Compiling provided {0} external source code references".info(ExtraSourceCodeFilesToCompile.size());
         var assembly = new CompileEngine(UseCachedAssemblyIfAvailable).compileSourceFiles(ExtraSourceCodeFilesToCompile);
         if (assembly != null)
         {
             ReferencedAssemblies.Add(assembly.Location);
             CompileEngine.setCachedCompiledAssembly(ExtraSourceCodeFilesToCompile, assembly);
             generateDebugSymbols = true;                // if there are extra assemblies we can't generate the assembly in memory
         }
     }
 }
        public void resolveFileLocationsOfExtraSourceCodeFilesToCompile()
        {
            if (ExtraSourceCodeFilesToCompile.size() > 0)
            {
                // try to resolve local file references
                try
                {
                    if (this.SourceCodeFile.isNull())           // in case this is not set
                    {
                        SourceCodeFile = PublicDI.CurrentScript;
                    }
                    for (int i = 0; i < ExtraSourceCodeFilesToCompile.size(); i++)
                    {
                        var fileToResolve = ExtraSourceCodeFilesToCompile[i].trim();

                        var resolved = false;
                        // try using SourceCodeFile.directoryName()
                        if (fileToResolve.fileExists().isFalse())
                        {
                            if (SourceCodeFile.valid() && SourceCodeFile.isFile())
                            {
                                var resolvedFile = SourceCodeFile.directoryName().pathCombine(fileToResolve);
                                if (resolvedFile.fileExists())
                                {
                                    ExtraSourceCodeFilesToCompile[i] = resolvedFile;
                                    resolved = true;
                                }
                            }
                        }
                        // try using the localscripts folders
                        var localMapping = fileToResolve.local();
                        if (localMapping.valid())
                        {
                            ExtraSourceCodeFilesToCompile[i] = localMapping;
                            resolved = true;
                        }

                        if (resolved.isFalse() && fileToResolve.fileExists().isFalse())
                        {
                            ExtraSourceCodeFilesToCompile[i] = ExtraSourceCodeFilesToCompile[i].fullPath();
                        }
                    }
                }
                catch (Exception ex)
                {
                    ex.log("in compileExtraSourceCodeReferencesAndUpdateReferencedAssemblies while resolving ExtraSourceCodeFilesToCompile");
                }
            }
        }
        public void resolveFileLocationsOfExtraSourceCodeFilesToCompile()
        {
            if (ExtraSourceCodeFilesToCompile.size() > 0)
            {
                //List<string> o2LocalScriptFiles = null;
                // try to resolve local file references
                try
                {
                    //var currentScriptFolder = PublicDI.CurrentScript.directoryName();
                    if (this.SourceCodeFile.isNull())           // in case this is not set
                    {
                        SourceCodeFile = PublicDI.CurrentScript;
                    }
                    for (int i = 0; i < ExtraSourceCodeFilesToCompile.size(); i++)
                    {
                        var fileToResolve = ExtraSourceCodeFilesToCompile[i].trim();

                        //handle the File:xxx:Ref:xxx case
                        if (CompileEngine.isFileAReferenceARequestToUseThePrevioulsyCompiledVersion(fileToResolve, ReferencedAssemblies))
                        {
                            ExtraSourceCodeFilesToCompile[i] = "";
                        }
                        else
                        {
                            var resolved = false;
                            // try using SourceCodeFile.directoryName()
                            if (fileToResolve.fileExists().isFalse())
                            {
                                if (SourceCodeFile.valid())
                                {
                                    var resolvedFile = SourceCodeFile.directoryName().pathCombine(fileToResolve);
                                    if (resolvedFile.fileExists())
                                    {
                                        ExtraSourceCodeFilesToCompile[i] = resolvedFile;
                                        resolved = true;
                                    }
                                }
                            }
                            // try using the localscripts folders
                            if (resolved.isFalse() && fileToResolve.fileExists().isFalse())
                            {
                                var mappedFile = CompileEngine.findScriptOnLocalScriptFolder(fileToResolve);
                                if (mappedFile.valid())
                                {
                                    ExtraSourceCodeFilesToCompile[i] = mappedFile;
                                }
                            }
                        }
                    }
                    //add extra _ExtensionMethods.cs if avaiable
                    for (int i = 0; i < ExtraSourceCodeFilesToCompile.size(); i++)
                    {
                        var extensionMethod = ExtraSourceCodeFilesToCompile[i].replace(".cs", "_ExtensionMethods.cs");
                        if (extensionMethod.fileExists() && ExtraSourceCodeFilesToCompile.contains(extensionMethod).isFalse())
                        {
                            if (this.SourceCodeFile != extensionMethod)
                            {
                                ExtraSourceCodeFilesToCompile.Add(extensionMethod);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    ex.log("in compileExtraSourceCodeReferencesAndUpdateReferencedAssemblies while resolving ExtraSourceCodeFilesToCompile");
                }
            }
        }