简体   繁体   中英

Azure DevOps: Make Nuget-Package with AssemblyVersion

I have a Vb.Net-Project which has a dll-file as output. This dll should be packed in a nuget-package. I already have a.nuspec-file, because we are migrating from bitbucket to dev.azure.com. The nuget-package-version should have the same version-number as the dll-file has.

Now in Azure-Pipelines I have a YAML which should pack the nuget and push it. I don't get it to work properly because I do not know:

a) How to read out the assembly-version. a.1) Is it stored in this variable: $(Build.BuildNumber)? b) How to set up the "nuget-pack" command properly. Maybe there is an easy way which I do not see...

Nuspec-File

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
  <metadata>
    <id>$id$</id>
    <version>$version$</version>
    <title>$title$</title>
    <authors>XY</authors>
    <owners>$author$</owners>
    <projectUrl>http://bitbucket.xy.local/projects/NUGET/repos/somedllproject</projectUrl>
    <iconUrl></iconUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>$description$</description>
    <releaseNotes>See Git.</releaseNotes>
    <copyright>Copyright 2018 XY GmbH</copyright>
    <tags>core</tags>
  </metadata>
</package>

I think I managed it in the meantime....

Instead of using the nuspec I now use the.vbproj. I thought this was not possible because it was not mentioned in the azure help section.

YML task:

task: NuGetCommand@2
inputs:
  command: 'pack'
  packagesToPack: '**/Source/*.vbproj'
  versioningScheme: 'off'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM