How to add an icon to a nuget package?

Michael picture Michael · Jul 12, 2016 · Viewed 13.4k times · Source

We are hosting our own nuget server through Teamcity. Is there any other way to add an icon to a .nuspec file other than specifying a web url (http://....)?

Or is there a place in Teamcity that these icons could be hosted?

Answer

Wiktor Bednarz picture Wiktor Bednarz · Sep 27, 2019

As of NuGet 5.3.0 you can now use <icon> to provide a relative path to your JPEG or PNG icon file located within your package.

<package>
  <metadata>
    ...
    <icon>images\icon.png</icon>
    ...
  </metadata>
  <files>
    ...
    <file src="..\icon.png" target="images\" />
    ...
  </files>
</package>

Source: https://docs.microsoft.com/en-us/nuget/reference/nuspec#icon

<iconUrl> is now deprecated.