Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 8, 2025

The Azure Pipelines build was producing NuGet packages with version 1.0.0 instead of the configured version 9.2.0 defined in the pipeline variables. This occurred because the project file lacked an explicit Version property, causing .NET to default to 1.0.0 despite the pipeline attempting to override it.

Root Cause

The Xunit.Microsoft.DependencyInjection.csproj file had no explicit version configuration, so dotnet pack defaulted to version 1.0.0. While the Azure Pipeline used /p:PackageVersion=$(Major).$(Minor).$(Revision) to override this, the approach was unreliable.

Solution

  1. Added explicit Version property to .csproj:

    <Version Condition="'$(Version)' == ''">9.2.0</Version>

    This ensures local builds produce version 9.2.0 instead of 1.0.0.

  2. Updated Azure Pipeline for reliability: Changed from /p:PackageVersion= to /p:Version= for more consistent version override behavior.

Testing

  • ✅ Local builds now produce Xunit.Microsoft.DependencyInjection.9.2.0.nupkg
  • ✅ Version override works: /p:Version=9.3.0 produces correct 9.3.0 package
  • ✅ Pipeline simulation with exact Azure DevOps command produces 9.2.0 package
  • ✅ All 43 example tests continue to pass

This fix ensures that both local development builds and CI/CD pipeline builds produce packages with the correct version number, eliminating the issue where 1.0.0 packages were being published to NuGet.org.

Fixes #322.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] An invalid version number is produced prior to publishing the package to NuGet.org Fix invalid version number issue in Azure Pipelines NuGet package publishing Sep 8, 2025
Copilot finished work on behalf of Arash-Sabet September 8, 2025 01:47
@Arash-Sabet Arash-Sabet marked this pull request as ready for review September 8, 2025 01:49
@Arash-Sabet Arash-Sabet merged commit d721af2 into main Sep 8, 2025
1 check passed
@Arash-Sabet Arash-Sabet deleted the copilot/fix-322 branch September 8, 2025 01:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

An invalid version number is produced prior to publishing the package to NuGet.org
2 participants