Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

GitVersion not creating the correct NuGet package version number in Azure pipeline

$
0
0

I'm trying to set up a pipeline in Azure DevOps Server that will automatically publish private NuGet packages.

I'm using GitVersion to determine the package version number. I want to use the tag associated with the commit for the version number. The reason why is I'm using this pipeline on existing NuGet packages that already have specific version numbers like '1.0.15.0' or '2.1.5.2'.

GitVersion is ignoring the commit tag and generating a completely different version number. For example I created a git tag of '1.0.1.0' associated with a commit to a non-release branch, so the version number should have been '1.0.1.0-beta'. Instead the version generated in the pipeline was '0.1.0-beta0001'.

This is my GitVersion.yml:

mode: ContinuousDeliverybranches:  develop:    tag: ''    is-release-branch: true  database:    tag: beta    regex: ^database?[/-]    source-branches: ['develop', 'database']    is-release-branch: false  dotnet:    tag: beta    regex: ^dotnet?[/-]    source-branches: ['develop', 'dotnet']    is-release-branch: falseignore:  sha: []merge-message-formats: {}

Part of the YAML file I'm using:

- task: gitversion/setup@0  displayName: Install GitVersion  inputs:    versionSpec: '5.x'    includePrerelease: false- task: gitversion/execute@0  displayName: Determine Version  inputs:    useConfigFile: false    updateAssemblyInfo: false

I'm also trying to update the version number in the package's .csproj file. All of my packages' .csproj files uses the following format:

<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><TargetFramework>netstandard2.1</TargetFramework><GeneratePackageOnBuild>true</GeneratePackageOnBuild><Company>Company Name</Company><Version>1.0.0.0</Version><Authors>Joe Smith</Authors><RootNamespace>DemoPackage</RootNamespace><SignAssembly>false</SignAssembly><PackageReleaseNotes>created package</PackageReleaseNotes><LangVersion>8.0</LangVersion></PropertyGroup></Project>

I looked at the GitVersion documentation. I thought by using a git commit tag it would override the default versioning. How do I configure GitVersion to generate the version number I want and update the corresponding .csproj file?


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>