LibraryManager icon indicating copy to clipboard operation
LibraryManager copied to clipboard

Add VSTS Build Task [Feature Request]

Open Liero opened this issue 7 years ago • 10 comments

I would be nice to have a vsts build task, just like npm, or bower (in the marketplace). Until then, is there some guide how to integrate it with VSTS hosted build agent?

Thanks

Liero avatar Sep 10 '18 10:09 Liero

If you include the Microsoft.Web.LibraryManager.Build package from nuget, it will be done automatically as part of the dotnet build execution.

You can also enable it by right clicking on the libman.json file. https://github.com/aspnet/LibraryManager#context-menu

nickalbrecht avatar Sep 12 '18 17:09 nickalbrecht

Thanks @nickalbrecht, that is convenient way, but I still prefer separate build task in VSTS.

VSTS templates for .net core have separate build task for dotnet restore. So restoring .NET packages is in separate build task, but downloading javascript libraries should be part of dotnet build. That sounds weird to me.

Liero avatar Sep 14 '18 06:09 Liero

Well the source for the Build task is very small. It could always be adapted to a dedicated command as a global tool if you wanted to try adapting it and offering it to the project as a contribution. That would let you call it as a dedicated task.

nickalbrecht avatar Sep 14 '18 16:09 nickalbrecht

The Microsoft.Web.LibraryManager.Build package is for any MSBuild based build, it isn't dotnet specific.

jimmylewis avatar Sep 14 '18 16:09 jimmylewis

I assumed it was a typo in his sentence, and that he meant to say "shouldn't be part of dotnet build". But I'm not aware of any way to hook into the restore command.

nickalbrecht avatar Sep 14 '18 17:09 nickalbrecht

@nickalbrecht I see. After a re-read, I think I better understand the feedback now: the LibMan restore process should hook the project's Restore, not the Build.

jimmylewis avatar Sep 14 '18 17:09 jimmylewis

Well, I don't think dotnet restore is the right place either. dotnet restore is for nuget packages. just like there is npm install for npm, bower install for bower, I would welcome libman install or libman restore.

why? if dotnet restore fails, everybody assumes it is a problem with nuget. Similarly with msbuild. CDN is an external dependency and I don't want my dotnet build fail if there is an external problem.

there is a reason why dotnet restore is separated from dotnet build and for the same reason should be separate task aalo libman restore.

Meanwhile, it is posible to use command prompt on VSTS to restore the packages?

Liero avatar Sep 15 '18 09:09 Liero

there is a reason why dotnet restore is separated from dotnet build and for the same reason should be separate task aalo libman restore.

dotnet restore is not separated from dotnet build any more :)

Now, a restore is implicitly ran with several of the dotnet commands.

ronnieoverby avatar Sep 27 '18 21:09 ronnieoverby

@ronnieoverby: How so? I understand that if you run dotnet build without restoring packages first, it will restore them automatically, which is good, but it is a good practice in CI pipeline to have separate build task for dotnet restore for better debugging, isn't it?

Liero avatar Sep 28 '18 07:09 Liero

I've created Azure DevOps extension that adds "Restore Libman" build step to DevOps project.

See: https://marketplace.visualstudio.com/items?itemName=Liero.Libman

Source Code: https://github.com/Liero/libman-vsts-extension.

Feel Free to clone if you want to support it officialy

Liero avatar Oct 01 '18 15:10 Liero