Guide: Deploying an App to Chocolatey
This guide walks you through deploying your application to Chocolatey.
1. Set Up Environment
- Install Chocolatey CLI:
powershell
Set-ExecutionPolicy Bypass -Scope Process -Force; \
[System.Net.ServicePointManager]::SecurityProtocol = \
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072; \
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
- Ensure NuGet is available (required for
.nupkgpackages).
2. Prepare Package Structure
- Folder structure:
MyApp/
├─ tools/
│ └─ myapp.exe (or installer script)
└─ MyApp.nuspec
.nuspecexample:
xml
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>myapp</id>
<version>1.0.0</version>
<authors>YourName</authors>
<owners>YourName</owners>
<licenseUrl>https://yourlicense.com</licenseUrl>
<projectUrl>https://yourproject.com</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>MyApp does X, Y, Z</description>
<tags>tool utility cli</tags>
</metadata>
</package>
3. Validate Package
- Install verifier:
powershell
choco install chocolatey-package-verifier
- Verify package:
powershell
choco pack
choco verify MyApp.nupkg
4. Create Chocolatey Account
- Sign up at Chocolatey.org.
- Copy your API key from account settings.
5. Push Package
- Create
.nupkg:
powershell
choco pack MyApp.nuspec
- Push to Chocolatey:
powershell
choco push MyApp.1.0.0.nupkg --source https://push.chocolatey.org/ --api-key YOUR_API_KEY
6. Post-Submission
- Chocolatey will review the package.
- Once approved, it can be installed:
powershell
choco install myapp
Tips
- Prefer scripts that download installers instead of bundling binaries.
- Test locally:
powershell
choco install myapp -s .
- Follow naming conventions: lowercase, no spaces.
- Update
.nuspecversion for each release.