Skip to content

CI: dotnet pack --version: is not a valid option for setting the package version #2

Description

@beyondnetPeru

The Pack step passes the version like this:

dotnet pack "${{ matrix.project }}" \-c Release \--version:${{ needs.version.outputs.version }} \--no-build \-p:PackageOutputPath=${{ github.workspace }}/nupkgs

--version is not a dotnet pack option for setting the package version. The value has to travel as an MSBuild property — -p:PackageVersion=<version>, or -p:Version=<version> if you want assembly and package version driven together.

Acceptance criteria

  • The produced .nupkg filename carries the version coming from the tag (e.g. BeyondNetCode.Shell.Aop.1.0.0.nupkg).
  • A non-tag push still produces the 0.0.0-<branch>+<sha> fallback without failing the workflow.

Why this is a good first issue

One-line change in a single file, and you can verify it locally in under a minute:

dotnet pack BeyondNetCode.Shell.Aop/BeyondNetCode.Shell.Aop.csproj -c Release -p:PackageVersion=1.2.3

Check the filename of the produced .nupkg.

Where

.github/workflows/build.ymlpack job → Pack step.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions