'Failed to install tool' errors when running Cake on Linux

If you're not already using Cake for all your cross-platform build needs, you're missing out! It's flexible, powerful and super-simple to get started with!

Out of the box, Cake runs on Linux using Mono, but there is also Cake.CoreCLR which supports running anywhere .NET Core runs.

If you're using Cake on Linux, you may sometimes see an error that Cake "Failed to install tool: 'YourToolNameHere'". In my case, I was getting this for the DocFx.Console package, which I added to my script as below:

#tool nuget:?package=DocFX.Console

Run ./build.sh and immediately it fails:

$ ./build.sh 
All packages listed in /home/achapman/Source/TEMP/caketest/tools/packages.config are already installed.
Analyzing build script...
Processing build script...
Installing tools...
Could not find any relevant files for tool 'DocFx.Console'. Perhaps you need an include parameter?
Error: Failed to install tool 'DocFx.Console'.

The reason for this is deceptively simple, and won't show when running on Windows: case-sensitivity.

Some packages, including docfx.console, are lower-case named, and on Linux (since the filesystem is case-sensitive), you need to match the casing in your #tool directive. First, check what the package's name on disk is:

[agc93 ~/caketest]$ ls tools/
total 4.5M
drwxrwxr-x. 2 achapman achapman 4.0K Jun 20 10:07 Cake
drwxrwxr-x. 5 achapman achapman 4.0K Jun 20 10:07 docfx.console
-rw-rw-r--. 1 achapman achapman 4.4M Jun 20 10:06 nuget.exe
-rw-rw-r--. 1 achapman achapman  105 Jun 20 10:06 packages.config
-rw-rw-r--. 1 achapman achapman   33 Jun 20 10:07 packages.config.md5sum

(note the all-lowercase folder name)

Next, update your build.cake with the correct directive:

#tool nuget:?package=docfx.console

You can now run build.sh again and your tool should be picked up and found correctly!

default output


comments powered by Disqus