Ejemplo n.º 1
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 is null)
        {
            throw new ArgumentNullException(nameof(settings));
        }

        if (settings.WorkingDirectory is not 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>());
        if (m_directory != ".")
        {
            settings.WorkingDirectory = m_directory;
        }

        return(RunDotNet(settings));
    }