azurexsltazure-devopscicd

Execute XSLT in Azure DevOps Pipeline


I have a VSTO Visio Addin that is built using Azure DevOps CICD.

As part of the pipeline I would like a stage task to automate the execution of a XSLT that will process various Visual Studio *.csproj files to generate a JSON that can be deployed with the VSTO Addin.

I have developed a XSLT that works fine from the command line, however it is not clear how I might automate this is the CICD pipeline build. Looking at the MS pipeline tasks, it seems thta I might implement the following:

Is there any CLI and/or Powershell support that would be simpler and more light weight?

Any thoughts would be gratefully received.

Cheers, Andrew


Solution

  • This is supported by Powershell - sample code below for the CICD task

    - task: PowerShell@2
      inputs:
        targetType: 'inline'
        script: |
         $Xslt = New-Object System.Xml.Xsl.XslCompiledTransform
         $PathToXsltFile = "$pwd\transformer.xslt"
         $XsltSettings = New-Object System.Xml.Xsl.XsltSettings
         $XsltSettings.EnableDocumentFunction=1
         $XmlResolver = New-Object System.Xml.XmlUrlResolver
         $Xslt.Load($PathToXsltFile, $XsltSettings, $XmlResolver)
         $Xslt.Transform("$pwd\source.xml", "$pwd\target.xml")