0
votes

I'm building a custom Release-task for VSTS. I'm building it with Node and Typescript. Is there any way that I, in my task, can download a NuGet-package? Something like this:

import nuget = require('nuget-lib');
import tl = require('vsts-task-lib/task');

async function run() {
    try {
        console.log('Starting... Will try to download latest nuget.')

        const package = nuget.fetch('Microsoft.EntityFrameworkCore.Tools');
        // Do stuff with package...

        console.log('Task done!');
    }
    catch (err) {
        tl.setResult(tl.TaskResult.Failed, err.message);
    }
}

run();

My task needs some stuff in the NuGet-package, and I don't wish to include it in the package itself because then I need to update the package if the NuGet-package is updated.

I know that I can let my Build-step include the necessary packages in an artifact, but I want my Release-step to be able to run without those dependencies.

1

1 Answers

1
votes

Just call nuget.exe install command in your code, which is similar to the NuGet task: VSTS-tasks/Tasks/NuGet