Run dotnet local tool (if exists), fallback to global tool (if exists) #2952
-
Hi everyone. Does anyone have a good strategy to execute dotnet tools with Cake, in a way that it works regardless of how the tool was installed (local or global) - however giving priority to the local tool (if one exists)? The issue I'm trying to workaround is the fact that if a dotnet tool is called
I know I can use So far, I considered:
I'm not particularly happy with any of these options if I'm honest, as they all seem hacky to me 😕 Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
@augustoproiete have you seen the Cake.DotNetTool.Module`? https://github.com/cake-contrib/Cake.DotNetTool.Module This will allow you to express that a tool should be installed in the same way as an addin or NuGet tool, for example:
You can specify whether it should be installed globally or not, along with other options, using parameters: https://cake-contrib.github.io/Cake.DotNetTool.Module/docs/usage/parameters This would allow you to directly control what, and how, tools should be installed. Does this help? One thing to note, if you do make use of this, and you are using 0.38.5 or earlier of Cake, you will need to execute the bootstrap option when running Cake to make sure that this Module is loaded correctly. However, if you are using the RC version of Cake 1.0.0, you don't need to do this. |
Beta Was this translation helpful? Give feedback.
-
@gep13 haha I meant Cake Add-In... Plugin/Add-In, Tomayto/Tomahto 😄 😄 I have a Cake Add-In that leverages In this workflow we expect the user of the Cake add-in to have installed the dotnet tool in advance (local or global) e.g.:
build.cake
Luckily for Re: Given the above, I would prefer not to force the developer writing the Cake script / using my Cake Add-in to have to use The way that So in the end I guess you did answer my question and it doesn't seem to be a better way to check if a local tool is installed, other than running Thanks for the help. I very much appreciate the ideas! |
Beta Was this translation helpful? Give feedback.
@augustoproiete have you seen the Cake.DotNetTool.Module`? https://github.com/cake-contrib/Cake.DotNetTool.Module
This will allow you to express that a tool should be installed in the same way as an addin or NuGet tool, for example:
You can specify whether it should be installed globally or not, along with other options, using parameters:
https://cake-contrib.github.io/Cake.DotNetTool.Module/docs/usage/parameters
This would allow you to directly control what, and how, tools should be installed.
Does this help?
One thing to note, if you do make use of this, and you are using 0.38.5 or earlier of Cake, you will need to execute the boo…