/**
   * Transforms this command object into a array of string that can be passed to the
   * CommandExecutor, and generates the required MSBuild file to execute StyleCop.
   *
   * @return the Command that represent the command to launch.
   */
  public Command toCommand() {
    validate();
    MsBuildFileGenerator msBuildFileGenerator =
        new MsBuildFileGenerator(solution, styleCopConfigFile, styleCopReportFile, styleCopFolder);
    File msBuildFile =
        msBuildFileGenerator.generateFile(styleCopReportFile.getParentFile(), vsProject);

    LOG.debug("- MSBuild path          : " + dotnetSdkDirectory.getAbsolutePath());
    Command command = Command.create(new File(dotnetSdkDirectory, "MSBuild.exe").getAbsolutePath());

    LOG.debug("- Application Root      : " + solution.getSolutionDir().getAbsolutePath());
    command.addArgument("/p:AppRoot=" + solution.getSolutionDir().getAbsolutePath());

    LOG.debug("- Target to run         : StyleCopLaunch");
    command.addArgument("/target:StyleCopLaunch");

    if (!LOG.isDebugEnabled()) {
      command.addArgument("/noconsolelogger");
    }

    LOG.debug("- MSBuild file          : " + msBuildFile.getAbsolutePath());
    command.addArgument(msBuildFile.getAbsolutePath());

    return command;
  }