This repository deals with how the implementation of validating rules valid for the Chocolatey Community Repository are implemented. This project is meant to be published as a Chocolatey CLI extension that users can install to validate their packages does not violate any of the rules required to be passing when pushing packages to Chocolatey Community Repository. Additionally, it is intended that the Package Validator will eventually reference an internal only NuGet package of this project to prevent the need to duplicate rules in both places.
To build this project, the following requirements must be met.
- NET 4.8 installed
- Visual Studio 2022 (2019 and 2017 may work, but is untested)
- Ability to Compile Debug version of Chocolatey CLI
- Microsoft Visual Studio Code (for non C# source files)
Before being able to build the project through Visual Studio and to debug the project, it is required to run the script Get-ChocoDebugLibraries.ps1
first.
Running this script will take care of the necessary prerequisite steps to be able to build and debug the project.
The steps to follow in this case is:
There are two options to be able to get the debug version of Chocolatey CLI.
- The first option is to clone the Chocolatey CLI project to a specific location and reuse this location.
a. Clone the
chocolatey/choco
repository to your preferred location. b. Run.\Get-ChocoDebugLibraries.ps1 -ChocoSourceLocation <PATH_TO_SOURCE_ROOT>
(ChocoSourceLocation
may be defined as the environment variableCHOCO_SOURCE_LOCATION
) - The second option is to let the debug script clone the necessary repository, and check out the referenced tag. (NOTE: It is very important you do not have the environment variable
CHOCO_SOURCE_LOCATION
set in this case). a. Run.\Get-ChocoDebugLibraries.ps1 -CheckoutRefTag
(Alternatively you can check out a specific tag or branch using.\Get-ChocoDebugLibraries.ps1 -CheckoutTag 2.0.0
).
- During debugging there may be no information about the variables being used, this is due to referencing
chocolatey.dll
instead ofchoco.exe
. It is uncertain of how to fix this problem at this time. - When implementing rules, it is required to use the full global namespace of
NuspecReader
. This is due to us not directly referencing any of theNuGet.Client
libraries ourselves.