コード例 #1
0
        /// <summary>
        /// Helper method to clean up
        /// </summary>
        private void RemoveCopiedAssemblies()
        {
            if (!CleanupAfterExit || _assembliesToDeleteAtExit.Count == 0)
            {
                return;
            }

            if (Log.IsVerboseEnabled())
            {
                Log.Verbose().WriteLine("Removing cached assembly files: \r\n\t{0}", string.Join("\r\n\t", _assembliesToDeleteAtExit.Select(a => $"\"{FileTools.NormalizeDirectory(a)}\"")));
            }

            var info = new ProcessStartInfo
            {
                Arguments      = "/C choice /C Y /N /D Y /T 3 & Del " + string.Join(" ", _assembliesToDeleteAtExit),
                WindowStyle    = ProcessWindowStyle.Hidden,
                CreateNoWindow = true,
                FileName       = "cmd.exe"
            };

            _assembliesToDeleteAtExit.Clear();
            Process.Start(info);
        }