Ejemplo n.º 1
0
 /// ------------------------------------------------------------------------------------
 /// <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;
 }
Ejemplo n.º 2
0
        /// ------------------------------------------------------------------------------------
        /// <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);
            }
        }