Skip to content

How to add icon URL [deprecated]

Miodrag Milić edited this page Apr 21, 2017 · 1 revision

NOTE: This section is deprecated and here for historical reasons. Icon is now handled automatically


You got three suggested options to add an icon to the the iconUrl element in the package nuspec file.

Add the rawgit url to the package nuspec

NOTE: If the package do not have an icon, add the following somewhere in the package nuspec file <!-- IconUrl: Skip check -->

Automatic

  1. Download and save the icon in the icons folder using the same file name as the package name (.install, .portable and .commandline suffixes can be excluded).
  2. Add and Commit the icon.
  3. Add an empty <iconUrl></iconUrl> element to the package nuspec file.
  4. Push the changes to the repository/Pull Request.
  5. When the package is updated, the icon url will be automatically generated and added to the package nuspec file.

Manually

  1. Download and save the icon in the icons folder.
  2. Add and Commit the icon.
  3. Run the following to get the commit hash: git log -1 --format="%H" [optional path to icon if not last commit]
  4. Push an icon file to the repository and navigate to its raw link on GitHub of the commit where the icon was added, e.g. https://raw.githubusercontent.com/chocolatey/chocolatey-coreteampackages/edba4a5849ff756e767cba86641bea97ff5721fe/icons/picard.png
  5. Replace “https://raw.githubusercontent” of the URL with “https://cdn.rawgit”, so the URL from the example above would become to https://cdn.rawgit.com/chocolatey/chocolatey-coreteampackages/edba4a5849ff756e767cba86641bea97ff5721fe/icons/picard.png
  6. Use the URL from 2. as package iconUrl. Rawgit will automatically fetch the icon from GitHub on the first HTTP request and cache it permanently. Therefore the specific commit hash is needed to be able to update the icon, using the same URL and only replace the commit SHA1 with the new one.
  7. Type (or paste) the resulting cdn.rawgit url obtained from the previous step to the <iconUrl>URL_GOES_HERE</iconUrl> location in the package nuspec file.

Using PowerShell

  1. Download and save the icon in the icons folder.
  2. Run the following powershell script located in the setup directory: .\scripts\Update-IconUrl.ps1 packageName [-IconName optionalIconName]
  3. All done