Open Liero opened 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
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.
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.
The Microsoft.Web.LibraryManager.Build
package is for any MSBuild based build, it isn't dotnet
specific.
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 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.
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?
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: 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?
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
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