/// <summary>
        /// 
        /// </summary>
        /// <param name="bestEffort">How many tries should do. Each try remove a not compiling item.</param>
        /// <param name="assemblyName">The output assembly name.</param>
        /// <param name="assemblyPath">The output assembly path.</param>
        /// <param name="compilerDescriptor">The specifications for the compilation.</param>
        /// <param name="tempPath">A temporary path where the .cs files will be stored.</param>
        public void Initialize(int bestEffort, string assemblyName, string assemblyPath,
            ISourceCompilerDescriptor compilerDescriptor, string tempPath)
        {
            _bestEffort = Math.Max(1, bestEffort);
            _assemblyName = assemblyName;
            _assemblyPath = assemblyPath;
            _compilerDescriptor = compilerDescriptor;
            _tempPath = tempPath;

            foreach (var toLoad in _compilerDescriptor.Assemblies)
            {
                try
                {
                    AppDomain.CurrentDomain.Load(File.ReadAllBytes(toLoad));
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(ex.Message);
                }
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="asmName">The new name for the assembly</param>
        /// <param name="asmPath">The new assembly path</param>
        public SourceCompiler(string asmName, string asmPath)
        {
            _preloadedAssembly = new ConcurrentDictionary<string, Assembly>();
            AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;

            AddSearchAssembly(Assembly.GetExecutingAssembly());
            Errors = new List<List<string>>();
            _asmName = asmName;
            _asmPath = asmPath;
            var fullPath = Path.Combine(_asmPath, _asmName + ".dll");
            if (File.Exists(fullPath)) File.Delete(fullPath);
            _sourceCompilerDescriptor = new SourceCompilerDescriptor();
            _references = new Dictionary<string, object>();
        }
        /// <summary>
        /// To move data outside of appdomain.
        /// </summary>
        /// <param name="d"></param>
        public void CopyTo(ISourceCompilerDescriptor d)
        {
            foreach (var item in _files)
            {
                var val = item.Value;
                d.AddFile(val.OnlyNamespace, val.OnlyClass, val.ClassSource);
            }

            foreach (var item in _assemblies)
            {
                var val = item.Value;
                d.AddAssembly(val);
            }
        }