Pinning Cake Version

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="4.0.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.

  1. Pin version of Cake in the tools/packages.config file:

    <?xml version="1.0" encoding="utf-8"?>
    <packages>
        <package id="Cake" version="4.0.0" />
    </packages>

  2. Commit tools/packages.config file to source control repository.

    This will require some tweaks to your .gitignore file. Below are the tweaks that will be required. The first line says to ignore all files underneath the tool directory. The second says to not ignore the packages.config file.

    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.

  1. Pin version of Cake in the tools/packages.config file:

    <?xml version="1.0" encoding="utf-8"?>
    <packages>
        <package id="Cake.CoreCLR" version="4.0.0" />
    </packages>

  2. Commit tools/packages.config file to source control repository.

    This will require some tweaks to your .gitignore file. Below are the tweaks that will be required. The first line says to ignore all files underneath the tool directory. The second says to not ignore the packages.config file.

    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.