public async Task <ScriptsCompileResult> Build(GameProject gameProject, FileInfo mainScript, bool releaseMode) { string scriptsPath = mainScript.DirectoryName; _compilationOptions = _compilationOptions.WithSourceReferenceResolver( new SourceFileResolver(ImmutableArray <string> .Empty, scriptsPath)); if (releaseMode) { _compilationOptions = _compilationOptions.WithOptimizationLevel(OptimizationLevel.Release); } if (!releaseMode && mainScript.LastWriteTime < _lastBuildTime) { return(new ScriptsCompileResult()); } string scriptCode = File.ReadAllText(mainScript.FullName); ScriptsCompileResult result = await Task.Run(() => GenerateGameAssembly(scriptCode)); if (result.Errors == null) { _lastBuildTime = DateTime.Now; } return(result); }