To have deterministic builds it is important that on every build the same version of Cake is used.
When installed as a local tool, Cake will always be restored in the version mentioned in the manifest file which is usually located at .config/dotnet-tools.json.
We recommend storing this manifest file in source control so that every time you clone your repository and run dotnet tool restore you'll always get the same version of the Cake .NET Tool specified in the manifest file.
Make sure to use a fixed version number for Cake.Frosting in the *.csproj file:
<PackageReference Include="Cake.Frosting" Version="5.1.0" />
To update the version of Cake you are using after you have pinned it, all you need to do is update the Cake.Frosting NuGet package to the newer version you would like to use.
-
Pin version of Cake in the
tools/packages.configfile:
<?xml version="1.0" encoding="utf-8"?> <packages> <package id="Cake" version="5.1.0" /> </packages> -
Commit
tools/packages.configfile to source control repository.This will require some tweaks to your
.gitignorefile. Below are the tweaks that will be required. The first line says to ignore all files underneath thetooldirectory. The second says to not ignore thepackages.configfile.
tools/* !tools/packages.config
To update the version of Cake you are using after you have pinned it, all you need to do is update the version in the packages.config file to the newer version you would like to use.
-
Pin version of Cake in the
tools/packages.configfile:
<?xml version="1.0" encoding="utf-8"?> <packages> <package id="Cake.CoreCLR" version="5.1.0" /> </packages> -
Commit
tools/packages.configfile to source control repository.This will require some tweaks to your
.gitignorefile. Below are the tweaks that will be required. The first line says to ignore all files underneath thetooldirectory. The second says to not ignore thepackages.configfile.
tools/* !tools/packages.config
To update the version of Cake you are using after you have pinned it, all you need to do is update the version in the packages.config file to the newer version you would like to use.
