예제 #1
0
        /// <summary>
        /// Runs the specified .NET Framework command-line app.
        /// </summary>
        /// <param name="path">The path of the command-line app.</param>
        /// <param name="settings">The settings to use when running the app.</param>
        /// <remarks>On Linux and macOS, Mono is used to run the app.</remarks>
        public static int RunDotNetFrameworkApp(string path, AppRunnerSettings settings)
        {
            if (BuildEnvironment.IsUnix())
            {
                settings           = settings.Clone();
                settings.Arguments = new[] { path }.Concat(settings.Arguments ?? Enumerable.Empty <string>()).ToList();
                path = "mono";
            }

            return(RunApp(path, settings));
        }
예제 #2
0
        /// <summary>
        /// Runs the local tool with the specified settings.
        /// </summary>
        /// <param name="settings">The settings to use when running the tool.</param>
        public int Run(AppRunnerSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (settings.WorkingDirectory != null)
            {
                throw new ArgumentException($"{nameof(settings.WorkingDirectory)} not supported for local tools.", nameof(settings));
            }

            settings                  = settings.Clone();
            settings.Arguments        = new[] { "tool", "run", m_name, "--" }.Concat(settings.Arguments ?? Enumerable.Empty <string>());
            settings.WorkingDirectory = m_directory;

            return(RunDotNet(settings));
        }
예제 #3
0
 /// <summary>
 /// Runs the specified .NET tool with the specified settings.
 /// </summary>
 /// <param name="name">The name (or path) of the tool.</param>
 /// <param name="settings">The settings to use when running the app.</param>
 public static int RunDotNetTool(string name, AppRunnerSettings settings)
 {
     settings           = settings.Clone();
     settings.Arguments = new[] { "tool", "run", name, "--" }.Concat(settings.Arguments ?? Enumerable.Empty <string>());
     return(RunDotNet(settings));
 }