visual-studionugetnuget-packagenuget-spec

Embedded into NuGet package icon doesn't appear in VS


I generate a nuget package using my nuspec file below:

<?xml version="1.0" encoding="utf-8"?>
<package >
  <metadata>
    <id>CommonLib</id>
    <version>1.2.3</version>
    <authors>ABC</authors>
    <owners>ULC</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <license type="file">Licenses\License.txt</license>
    <icon>Icons\Icon.PNG</icon>
    <description>Common References</description>
    <copyright>Copyright (c) 2020</copyright>
    <tags>Common</tags>

      <dependencies>
          <group targetFramework="net48" />
      </dependencies>
  </metadata>

  <files>
      <file src="lib\net48\Common*.dll" target="lib/net48" />
      <file src="Licenses\License.txt" target="Licenses\" />
      <file src="Icons\Icon.PNG" target="Icons\" />
  </files>
</package>

The folder structure for the source data for packing is as the following:

RootDir
    Icons
        Icon.png
    lib
        net48
            Abc.dll
            Common1.dll
            Common2.dll
            xyz.dll
    Licenses
        License.txt
    My.nuspec

I successfully generate it. However, whether I host it locally or in my Azure Artifacts as private feed, then when I browse in VS2017 (that's what I currently have installed) to install for a project then the generated package doesn't show its embedded icon, instead, it shows the default nuget pack icon. I tried browsing either from my local feed or from Azure private feed, same thing. What's the reason my embedded into nuget pack icon is not being used?


Solution

  • Embedded into NuGet package icon doesn't appear in VS

    Actually, this is a well-known issue for nuget and for creating our own nuget feed, package source, or local address, the nuget icon cannot be displayed in the package manage UI. See this similar issue.

    So if you add comments in this github link to get the staff's attention so that they can focus on the issue and fix it.

    In your situation, you use private local nuget feed to install such nuget package and it cannot be realized and the latest version nuget.exe v5.5.1 does not support this so far.

    Solution

    Please upload your nuget package into nuget.org website an then use nuget.org nuget feed to install your nuget package.

    And nuget.org supports the sustom icon to show your nuget package.

    And then you can directly use nuget.org to install your own nuget package.

    l have test it:

    local feed:

    enter image description here

    nuget.org website:

    enter image description here

    Besides, you could suggest this feature in Our User Voice Forum to reflect your thoughts