package org.eobjects.build;

import java.io.File;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;

@Mojo(name = "pack", defaultPhase = LifecyclePhase.PACKAGE)
public class DotnetPackMojo extends AbstractDotnetMojo {

    @Parameter(defaultValue = "${project.version}", readonly = true)
    String version;

    @Component
    MavenProjectHelper projectHelper;

    @Parameter(defaultValue = "${project}", readonly = true)
    MavenProject project;

    @Parameter(property = "dotnet.pack.enabled", required = false, defaultValue = "true")
    boolean packEnabled;

    public void execute() throws MojoExecutionException, MojoFailureException {
        if (!packEnabled) {
            getLog().debug("Disabled, skipping");
            return;
        }

        final PluginHelper helper = getPluginHelper();
        for (File subDirectory : helper.getProjectDirectories()) {
            final String output = helper.getNugetPackageDir(subDirectory).getPath();
            helper.executeCommand(subDirectory, "dotnet", "pack", "-o", output, "-c", helper.getBuildConfiguration(),
                    "--version-suffix", version);

            final DotnetProjectFile projectFile = getPluginHelper().getProjectFile(subDirectory);

            projectHelper.attachArtifact(project, projectFile.getFile().getName(), projectFile.getFile());
        }
    }
}

@@ -1453,57 +1453,8 @@
 on()
-,%0A                    %22--version-suffix%22, version
 );%0A%0A

Remove --version-suffix argument from dotnet pack command invocation -- rely on the version prefix/suffix pair to be in the .csproj by pack time.