Azure DevOps - How to Package Templates

If you need to package the component templates in order to create an artifact that can be used for the reversal feature, you can create a simple TFS build which will:

  1. Obtains the templates from TFS Source Control.
  2. Package the NuGet package and publish so that it is available to your release process.

TFS Source Control

A) Check in the files and setup a new TFS build with the "Get sources" step mapped to the location of the templates, set the local path to be "NuGet" as shown below:

B) Create a DataStar.CmdLine Nu-spec File and add to the Source Control folder under templates (for example in a package folder):

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>
        <!-- Required elements-->
        <id>DataStar.CmdLine</id>
        <version>$version$</version>
        <description>DataStar Command Line</description>
        <authors>Absolute Technology Limited</authors>
        <!-- Optional elements -->
        <title>DataStar.CmdLine</title>
        <copyright>Copyright Absolute Technology Ltd: All rights reserved</copyright>
        <dependencies></dependencies>
    </metadata>
    <files>
        <file src="*\**\*.*" target=""/>
    </files>
</package>

C) Add a step to execute the "pack" NuGet command

Depending on the version of TFS you are using you made need to create a PowerShell Script to execute the pack command. Otherwise create the NuGet step and set the command to custom as shown below:

D) Publish the Build Artifacts

Configure a build step to publish the package.