Cake - install dotnet core tool

2019-08-26 10:11发布

I have a build.cake file where I need an external dotnet tool package installed. I would prefer managing installation of that tool in the cake file itself, so other people do not have to be aware that they need one more tool to be installed to be able to build the repository.

Is it possible to install it using #tool directive same way as for Nuget packages? Or do I need to use DotNetCoreTool() method for that purpose? Or probably there is another way?

1条回答
来,给爷笑一个
2楼-- · 2019-08-26 11:10

UPDATE: This functionality is now provided. An introduction blog post about it is here:

https://www.gep13.co.uk/blog/introducing-cake.dotnettool.module

ORIGINAL ANSWER:

There is nothing available "yet" that will allow you to do this. However, as early as yesterday (you have incredible timing!!) I have been working on a new module for Cake which will allow you to do exactly what you are asking. Once it is ready, the module will be available here:

https://github.com/cake-contrib/Cake.DotNetTool.Module

Once ready, you will be able to do something like the following:

#tool "dotnet:?package=Octopus.DotNet.Cli"

And it will take care of installing the required Global Tool. The pre-processor directive will have the ability to specify additional parameters, including:

  • tool path
  • version
  • source
  • framework
  • config file

I will update this answer once the initial version is published for you to take a look at.

查看更多
登录 后发表回答