//构建 public void ExecuteBuildCMD() { string fileName = mainEntity.ApkPath; Process process = InitProcess(); string buildName = Path.GetFileNameWithoutExtension(fileName).IndexOf(" ") > 0 ? "\"" + Path.GetFileNameWithoutExtension(fileName) + "\"" : Path.GetFileNameWithoutExtension(fileName); //输入dos命令 process.StandardInput.WriteLine(Path.GetPathRoot(fileName).Substring(0, 2)); process.StandardInput.WriteLine("cd {0}", Path.GetDirectoryName(fileName)); process.StandardInput.WriteLine("{0} b {1}", mainEntity.ApktoolPath, buildName); process.StandardInput.WriteLine("exit"); string strRst = process.StandardOutput.ReadToEnd(); //获取结果 Console.WriteLine("已执行了:{0}", strRst); process.WaitForExit(); //等待命令结束 process.Close(); //进程结束 iProcess.BuildEnd(); }