sandialabs/Arcus

NuGet Icon not configured properly do display both on NuGet site and Nuget PackageManager within Visual Studio

rheone opened this issue · 6 comments

After discovering stackoverflow "NuGet Package Icon Not getting Displayed" it appears that the PackageIcon csproj directive is not respected by the Nuget PackageManager within Visual Studio a documented issue that appears to be getting attention.

  • In theory icon and iconUrl are deprecated, but supported by both NuGet site and Nuget PackageManager within Visual Studio
  • Embedded icon, packageIcon is not supported by Nuget PackageManager within Visual Studio, but is supported by the NuGet site.

I would have to assume embedding and iconUrl will conflict, but experimentation is required.

This issue should be resolved in the next release of Visual Studio 16.5. see NuGet/Home#8772 (comment)

We are doing this work. Done now, but need some improvements. So likely shipping in VS 16.5. #8189 is tracking that work.

Until then, packages can choose to use the new technique, and leave the old url in the project and/or nuspec -- that will stop the warning, and still work in versions of VS that don't know how to show it yet.

Should we do anything for backwards compatibility?

If supporting backwards compatibility doesn’t break the new stuff I’d say we support both.

Compatibility requires testing, I’ve. It yet had a chance to investigate to my satisfaction

Hi! Is anybody here able to advise where there's a step-by-step guide for how to add an icon to a Nuget package with Visual Studio? I am not able to find it anywhere. My Google searches yield only links to StackOverflow and GitHub detailing the difficulties one might encounter with icons in Nuget packages.

I have tried to just select an icon (in the Package section of the Properties page of my .csproj file) but the icon just won't appear on the package when viewed in Nuget Package Manager.

Much appreciate any guidance! Thank you.

@BenjaminCharlton I don't have a step by step guide unfortunately, but I used the Microsoft .nuspec reference, random web posts, and investigating other projects on GitHub which lead me to add both a packageicon and packageiconurl tag in my csproj file.

<PropertyGroup>
///...
    <packageicon>icon.png</packageicon>
    <packageiconurl>https://raw.githubusercontent.com/sandialabs/Arcus/master/src/Arcus/icon.png</packageiconurl>
///...
</PropertyGroup>

Note that the packageicon path is retaliative to the csproj file. Also, there seems to be incompatibility with different versions of nuget and/or Visual Studio as to what lights up with which method, if any, of the provided icon. It would seem at the moment that while nuget.org happily displays our library icon, Visual Studio 16.8.6's version nuget does not.

Hi @rheone!

Thank you for reaching out to me. I appreciate it.
It's a shame there is no official documentation about how to do it yet. Maybe an expert will see this and fill that gap.

This looks very helpful; it's totally different to what Visual Studio generated for me.

I'm going to give it a try!

Much appreciated.
Benjamin