Addin vs Tool #3492
-
I've been thinking a bit about addins and tools and have some random questions about them. Hopefully some can help me sort this out :) What is the difference between an "addin" and a "tool"? It seems to me that tools need not specifically be created for Cake but can be any NuGet package (or dotnet cli package) that will be downloaded and "installled". Executables delivered as part of the tool can be resolved and executed from Cake. Cake does not load any assemblies from tools. Addins are of course also NuGet packages but assemblies in the Did I get that mostly right? Addins and Cake Frosting
How are the executables (tools) resolved for the second kind of addin in the context of Cake Frosting? Does Cake have support for resolving tools from the user's NuGet cache where they most likely will end up when using Cake Frosting? Is the second case even "good practice" or common? Documentation Tools are not mentioned in the documentation about extending Cake. Wouldn't it make sense to have at least a pointer from "Extending Cake" to the section about tools in "Writing builds"? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You got it right. We have documentation about tools and also how tool resolution works. The The ToolIf you have a NuGet package #addin "nuget:?package=MyPackage&version=1.2.3"
var myToolExePath = Context.Tools.Resolve("MyTool.exe");
StartProcess(myToolExePath, new ProcessSettings
{
Arguments = new ProcessArgumentBuilder()
.Append("some argument")
});
AddinAddins can provide functionality by exposing aliases that simplify the execution of C# code that you would normally have to write it yourself (e.g. In general, addins that are built with the purpose of wrapping command-line tools (such as This allows a nice separation between tool version and addin version, where new versions of the tool can be used without having to release new versions of the Cake addin every time. It also allows for different scenarios like:
|
Beta Was this translation helpful? Give feedback.
You got it right. We have documentation about tools and also how tool resolution works.
The
#tool
directive and the equivalentInstallTool
in Frosting, downloads a NuGet package, expands it on disk and scan the files in the package, making them available to the Cake build (and addins) for easy lookup via tool resolution.The
#addin
directive and the equivalent ofPackageReference
in Frosting, downloads a NuGet package, expands it on disk, scan the files for assemblies, and then loads them into the process.Tool
If you have a NuGet package
MyPackage
that contains a toolMyTool.exe
and you want to executeMyTool.exe
you would do something like this:#addin "nuget:?package=MyPackage&version=…