Inheritance: MonoDevelop.Projects.Project
        public Project CreateSingleFileProject(string sourceFile)
        {
            ProjectCreateInformation info = new ProjectCreateInformation ();
            info.ProjectName = Path.GetFileNameWithoutExtension (sourceFile);
            info.SolutionPath = Path.GetDirectoryName (sourceFile);
            info.ProjectBasePath = Path.GetDirectoryName (sourceFile);

            Project project = null;
            project = new TypeScriptProject (info, null);
            project.Files.Add (new ProjectFile (sourceFile));

            return project;
        }
        void ExecuteWithNode(TypeScriptProject project, TypeScriptProjectConfiguration conf, IProgressMonitor monitor, ExecutionContext context)
        {
            if (console != null)
                console.Dispose ();

            var exe = GetNodePath ();

            bool pause = conf.PauseConsoleOutput;

            monitor.Log.WriteLine ("Running project...");

            if (conf.ExternalConsole)
                console = context.ExternalConsoleFactory.CreateConsole (!pause);
            else
                console = context.ConsoleFactory.CreateConsole (!pause);

            AggregatedOperationMonitor operationMonitor = new AggregatedOperationMonitor (monitor);

            try {
                var cmd = CreateExecutionCommand (conf);

                if (!context.ExecutionHandler.CanExecute (cmd)) {
                    monitor.ReportError ("Cannot execute \"" + exe + "\". The selected execution mode is not supported for TypeScript projects.", null);
                    return;
                }

                IProcessAsyncOperation op = context.ExecutionHandler.Execute (cmd, console);

                operationMonitor.AddOperation (op);
                op.WaitForCompleted ();

                monitor.Log.WriteLine ("The operation exited with code: {0}", op.ExitCode);
            } catch (Exception ex) {
                monitor.ReportError ("Cannot execute \"" + exe + "\"", ex);
            } finally {
                operationMonitor.Dispose ();
                console.Dispose ();
            }
        }
        BuildResult ParseOutput(TypeScriptProject project, string stdOutAndErr)
        {
            BuildResult result = new BuildResult ();

            StringBuilder output = new StringBuilder ();
            bool enteredStackTrace = false;
            string next = string.Empty;
            foreach (var l in stdOutAndErr.Split ('\n').Select (l => l.Trim ()).Concat (new string [] {""})) {
                var line = next;
                next = l;
                output.AppendLine (line);

                if (next == "throw err;") {
                    result.Append (new BuildError () { ErrorText = "Internal compiler error occured. Check build output for details."});
                    enteredStackTrace = true;
                }

                if (enteredStackTrace || line.Length == 0 || line.StartsWith ("\t"))
                    continue;

                var error = new BuildError ();
                var match = error_rex.Match (line);
                if (match.Length > 0) {
                    error.FileName = match.Groups [1].ToString ().TrimEnd (' ');
                    error.Line = int.Parse (match.Groups [2].ToString ());
                    error.Column = int.Parse (match.Groups [3].ToString ());
                    error.ErrorText = match.Groups [4].ToString ();
                }
                else
                    error.ErrorText = line;
                result.Append (error);
            }

            result.CompilerOutput = output.ToString ();

            return result;
        }
        public BuildResult CompileWithTsc(TypeScriptProject project, TypeScriptProjectConfiguration configuration, IProgressMonitor monitor)
        {
            string exe = PropertyService.Get<string> ("TypeScriptBinding.TscLocation");
            exe = string.IsNullOrEmpty (exe) ? FindToolPath ("tsc") : exe;

            var outfile = project.GetTargetJavascriptFilePath ();
            var outdir = Path.GetDirectoryName (outfile);
            if (!Directory.Exists (outdir))
                Directory.CreateDirectory (outdir);

            var argList = new List<string> ();
            argList.Add ("--out");
            argList.Add (outfile.FirstOrDefault () == '"' ? '"' + outfile + '"' : outfile);

            if (configuration.DebugMode) {
                argList.Add ("-c");
                argList.Add ("--sourcemap");
            }

            if (project.AdditionalArguments != "")
                argList.Add (project.AdditionalArguments);

            if (configuration.AdditionalArguments != "")
                argList.Add (configuration.AdditionalArguments);

            foreach (var fp in project.Files.Where (pf => pf.Subtype == Subtype.Code && pf.BuildAction == "Compile"))
                argList.Add (fp.FilePath.FullPath);

            var args = String.Join (" ", argList.ToArray ());

            var stdOutErr = new StringWriter ();
            int exitCode = RunTool (exe, args, project.BaseDirectory, monitor, stdOutErr);

            BuildResult result = ParseOutput (project, stdOutErr.ToString ());
            if (result.CompilerOutput.Trim ().Length != 0)
                monitor.Log.WriteLine (result.CompilerOutput);

            if (result.ErrorCount == 0 && exitCode != 0)
            {
                string errorMessage = stdOutErr.ToString ();
                if (!string.IsNullOrEmpty (errorMessage))
                    result.AddError (errorMessage);
                else
                    result.AddError ("Build failed. Go to \"Build Output\" for more information");
            }

            return result;
        }