aspnet / LibraryManager

MIT License
454 stars 79 forks source link

Add VSTS Build Task [Feature Request] #372

Open Liero opened 5 years ago

Liero commented 5 years ago

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

nickalbrecht commented 5 years ago

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

Liero commented 5 years ago

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.

nickalbrecht commented 5 years ago

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.

jimmylewis commented 5 years ago

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

nickalbrecht commented 5 years ago

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.

jimmylewis commented 5 years ago

@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.

Liero commented 5 years ago

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?

ronnieoverby commented 5 years ago

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.

Liero commented 5 years ago

@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 commented 5 years ago

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