示例#1
0
        private void ExecuteFile(object sender, EventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            ProjectItem item   = VsHelpers.GetProjectItem(_dte);
            string      path   = item.FileNames[1];
            string      folder = Path.GetDirectoryName(path);

            string ext = Path.GetExtension(path);

            if (!string.IsNullOrEmpty(ext) && ext.ToLower() == ".ps1")
            {
                StartProcess(folder, "powershell.exe", "-ExecutionPolicy Bypass -NoExit -File \"" + Path.GetFileName(path) + "\"");
            }
            else
            {
                var    options   = GetDialogPage(typeof(Options)) as Options;
                string arguments = (options.Arguments ?? string.Empty).Replace("%folder%", folder);

                string confName = VsHelpers.GetSolutionConfigurationName(_dte);
                arguments = arguments.Replace("%configuration%", confName);

                string confPlatform = VsHelpers.GetSolutionConfigurationPlatformName(_dte);
                arguments = arguments.Replace("%platform%", confPlatform);

                arguments = arguments.Replace("%file%", Path.GetFileName(path));

                StartProcess(folder, options.Command, arguments);
            }
        }
示例#2
0
        private void OpenCustom(object sender, EventArgs e)
        {
            var    options   = GetDialogPage(typeof(Options)) as Options;
            string folder    = VsHelpers.GetFolderPath(options, _dte);
            string arguments = (options.Arguments ?? string.Empty).Replace("%folder%", folder);

            string confName = VsHelpers.GetSolutionConfigurationName(_dte);

            arguments = arguments.Replace("%configuration%", confName);

            string confPlatform = VsHelpers.GetSolutionConfigurationPlatformName(_dte);

            arguments = arguments.Replace("%platform%", confPlatform);

            StartProcess(folder, options.Command, arguments);
        }