/// -----------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="NantRunner"/> class.
        /// </summary>
        /// <param name="fileName">The filename and path of NAnt</param>
        /// <param name="commandLine">Command line</param>
        /// <param name="workingDirectory">Working directory</param>
        /// <param name="log">Log listener</param>
        /// <param name="handler">Build status handler</param>
        /// -----------------------------------------------------------------------------------
        internal NantRunner(string fileName, string commandLine, string workingDirectory,
			AddinLogListener log, BuildStatusHandler handler)
        {
            m_ProgramFileName = fileName;
            m_CommandLine = commandLine;
            m_WorkingDirectory = workingDirectory;
            m_Log = log;
            BuildStatusChange += handler;
        }
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Disposes the specified disposing.
 /// </summary>
 /// <param name="disposing">if set to <c>true</c> [disposing].</param>
 /// ------------------------------------------------------------------------------------
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         // Dispose managed resources here
         if (m_OutputBuild != null)
             m_OutputBuild.Dispose();
         if (m_LogListener != null)
             m_LogListener.Dispose();
         if (m_nantRunner != null)
             m_nantRunner.Dispose();
     }
     m_OutputBuild = null;
     m_LogListener = null;
     m_nantRunner = null;
 }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Runs Nant.
        /// </summary>
        /// <param name="cmdLine">The CMD line.</param>
        /// ------------------------------------------------------------------------------------
        public void RunNant(string cmdLine)
        {
            if (string.IsNullOrWhiteSpace(cmdLine))
                return;

            try
            {
                var solution = Parent.GetService(typeof(SVsSolution)) as IVsSolution;
                object solutionPath;
                solution.GetProperty((int)__VSPROPID.VSPROPID_SolutionFileName, out solutionPath);
                var buildFile = RetrieveBuildFile(solutionPath as string);

                cmdLine = string.Format("-e+ -buildfile:\"{0}\" {1} {2}", buildFile, TargetFramework, cmdLine);
                var workingDir = Path.GetFullPath(Path.GetDirectoryName(buildFile));

                StartBuild(string.Format("------ Build started: {0} ------\n", cmdLine));
                OutputBuild.Activate();
                m_LogListener = new AddinLogListener(this);
                m_nantRunner = new NantRunner(NAnt, cmdLine, workingDir,
                    m_LogListener,
                    BuildStatusChange);
                m_nantRunner.Run();
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            catch (Exception e)
            {
                if (m_nantRunner != null && m_nantRunner.IsRunning)
                    m_nantRunner.Abort();
                OutputBuild.Write("\nINTERNAL ERROR\n\t");
                OutputBuild.WriteLine(e.Message);
            }
        }