How to use custom parameters in chocolatey '.config' file?

I'm not quite sure I agree with your argument that the documentation doesn't cover this, but maybe perhaps that it is hard to find? We have it under the install article as that is where you would call a packages.config.

https://docs.chocolatey.org/en-us/choco/commands/install#packages.config

Included here:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="apackage" />
  <package id="anotherPackage" version="1.1" />
  <package id="chocolateytestpackage" version="0.1" source="somelocation" />
  <package id="alloptions" version="0.1.1"
           source="https://somewhere/api/v2/" installArguments=""
           packageParameters="" forceX86="false" allowMultipleVersions="false"
           ignoreDependencies="false"
           />
</packages>

Always try to check the documentation in the choco wiki - it's the most up-to-date. Plus the Chocolatey packages.config is not like the NuGet packages.config.


I totally agree with others that the documentation does not cover this important matter sufficiently. There is no example of its syntax of the fact the --params switch is equivalent to packageParameters attributes.

Here is an example of how to store params on the config file.

<?xml version="1.0" encoding="utf-8"?>
<packages>
       <package id="apache-httpd" packageParameters='/installLocation="D:\server\httpd"'/>
</packages>

Notice to the attribute name and its format.

Other similar tools use JSON format to store packages lists (PHP composer, NPM & ...) that is way more intuitive.

Tags:

Chocolatey