Speeding up Chocolatey downloads and installs.

nathan's Avatar


04 Mar, 2015 05:40 AM

Hello, on http://www.appveyor.com/docs/build-cache, you mention caching chocolatey:

It is possible to specify a dependency for each cache item: cache: - C:\ProgramData\chocolatey\lib -> appveyor.yml

However, I don't think you want to cache C:\ProgramData\chocolatey\lib for packages that download an external installer. If the lib folder is cached, the build process decides they are installed already and skips them.

I did find out that the downloads are stored here: C:\Users\appveyor\AppData\Local\Temp\chocolatey\ and caching that directory will reuse the previous downloads.

Any advice on a complete approach? Does the --force option handle the case when the lib folder is cached?

  1. Support Staff 1 Posted by Feodor Fitsner on 04 Mar, 2015 06:09 PM

    Feodor Fitsner's Avatar

    Anyway, caching Chocolatey packages/installations might be tricky as it depends on whether the package is "portable" or "native" (e.g. packages which are installed from MSI to Program Files).

    C:\Users\appveyor\AppData\Local\Temp\chocolatey\ is used as a temp location for downloading packages - I don't think it should be cached.

    Portable packages (7xip.commandline is a good example) are installed to C:\ProgramData\chocolatey\lib and "shim" is added to C:\ProgramData\chocolatey\bin. So, the solution for caching portable packages could be:

    - C:\ProgramData\chocolatey\bin -> appveyor.yml
    - C:\ProgramData\chocolatey\lib -> appveyor.yml

    If your build logic is in some my_build.cmd you can use it as a dependency instead of appveyor.yml.

  2. 2 Posted by nathan on 06 Mar, 2015 07:49 AM

    nathan's Avatar

    Evidently when I cancel a build, it removes the console output, otherwise I would have shown you that the caching of C:\ProgramData\chocolatey\lib for "native" installs (downloads an exe) causes the install to not take place because the [small] nupkg is already in place. The end result is the application doesn't work.

    For now, caching the Temp dir and not the lib and bin files is working.

  3. Support Staff 3 Posted by Feodor Fitsner on 06 Mar, 2015 03:04 PM

    Feodor Fitsner's Avatar

    So, every time you cancel a build its console cleared or it's sporadic error? How long does it take to build before you cancel?


  4. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:54 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac