Skip to content

Using a locally installed dotnet tool #4289

Answered by nils-a
Kemyke asked this question in Q&A
Discussion options

You must be logged in to vote

I am afraid you are mixing 2 different "tools".

When you use the pre-processor directive #tool, the tool installed in the local cake tools path. This is independent of the "normal" dotnet tool usage which always installs tools in the global tools path - even if that tool is installed locally.

I feel you have two solutions to your task:

using the #tool pre-processor directive

The installed tool can be resolved using Context.Tools.Resolve. Thus, code like the following should work:

#tool dotnet:?package=dotnet-sonarscanner

var target = Argument("target", "Default");

Task("Default")
.Does(() => {
   var exe = Context.Tools.Resolve("dotnet-sonarscanner.exe");
   Information("exe: {0}", exe);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by pascalberger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants