Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-contained icons support in the NuGet package manager UI in Visual Studio #8189

Closed
dominoFire opened this issue Jun 4, 2019 · 17 comments · Fixed by NuGet/NuGet.Client#3153

Comments

@dominoFire
Copy link
Contributor

Handle icon from both sources:

  • From inside the package
  • From Icon URL

The PM UI should be able to show packages with both icon types, transparent from the user

@dominoFire dominoFire self-assigned this Aug 20, 2019
@dominoFire dominoFire added this to the 5.4 milestone Oct 9, 2019
@rrelyea rrelyea modified the milestones: 5.4, 5.5 Oct 31, 2019
dominoFire pushed a commit to NuGet/NuGet.Client that referenced this issue Jan 16, 2020
@zkat zkat reopened this Mar 18, 2020
@zkat zkat closed this as completed Mar 18, 2020
@dominoFire dominoFire changed the title NuGet PackageManager UI handles icons from <icon/> and <iconUrl/> Embedded Icons support in NuGet PackageManager UI Mar 19, 2020
@dominoFire dominoFire changed the title Embedded Icons support in NuGet PackageManager UI NuGet PackageManager UI handles icons from <icon/> and <iconUrl/> Mar 19, 2020
@dominoFire dominoFire changed the title NuGet PackageManager UI handles icons from <icon/> and <iconUrl/> Embedded Icons support in NuGet PackageManager UI Mar 19, 2020
@kartheekp-ms kartheekp-ms added Type:Feature and removed Type:DCR Design Change Request labels Mar 20, 2020
@kartheekp-ms kartheekp-ms changed the title Embedded Icons support in NuGet PackageManager UI Embedded Icons support in the NuGet package manager UI in Visual Studio Mar 20, 2020
@karann-msft karann-msft changed the title Embedded Icons support in the NuGet package manager UI in Visual Studio Self-contained icons support in the NuGet package manager UI in Visual Studio Mar 23, 2020
@wouterroos
Copy link

Hi,

I'm not getting this to work on Visual Studio 16.5.4 running NuGet 5.5.1.6542. We've added the icon to our packages using the following entries in the *.csproj:

<PropertyGroup>
  <PackageIcon>content\logo.png</PackageIcon>
</PropertyGroup>

<ItemGroup>
  <None Include="logo.png" Pack="true" PackagePath="content"/>
</ItemGroup>

This causes it to show up correctly when opening the package in NuGet Package Explorer (not in the list view however) but Visual Studio still shows the default blue icon. We're publishing to a Azure DevOps Artifacts feed. Am I missing something?

Thanks!

@msallin
Copy link

msallin commented Apr 25, 2020

I've the same problem as described by @wouterroos

@rlordcardano
Copy link

Same issue here!

@tigrang-sci
Copy link

Still experiencing it. Please, add that feature.

@kennethkryger
Copy link

kennethkryger commented May 22, 2020

Using the solution from @wouterroos works for me. Using Visual Studio 2019 v16.6.0 and the NuGet packages is hosted Azure Artifacts (not that I think the location of the NuGet package matters...)

@rlordcardano
Copy link

Just upgraded to Visual Studio v16.6.0 - the only difference I see is that PackagePath is set to "content"... but looking into the nupkg files the icon is set to the right location and the image is included in the nupkg. So I don't think that can be the cause.

@rlordcardano
Copy link

Update - with version 16.7.0 of Visual Studio I can now see the package icon in the installed packages, however it does not display when looking at updates from our remote nexus server.

@augustoproiete
Copy link

@rlordcardano This seems like a Nexus-specific issue. My understanding is that Nexus* needs to be updated to support embedded icons and provide it to the client (as a URL). Otherwise Visual Studio would have to download every single package in the feed in order to extract the icon to display to you.

(*) and any other NuGet servers

@augustoproiete
Copy link

augustoproiete commented Aug 8, 2020

It will take a long time for all NuGet servers and clients to catch-up with this feature. For the time being, your best bet is to provide both an embedded icon and an URL icon in the same package as a fallback for any server and client that doesn't yet support the embedded icon.

csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <PackageIcon>images\icon.png</PackageIcon>
    <PackageIconUrl>https://company.com/icon.png</PackageIconUrl>
  </PropertyGroup>
  <ItemGroup>
    <None Include="..\..\assets\icon.png" Pack="true" Visible="false" PackagePath="images\icon.png" />
  </ItemGroup>
</Project>

nuspec

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
  <metadata minClientVersion="3.3">
    <icon>images\icon.png</icon>
    <iconUrl>https://company.com/icon.png</iconUrl>
  </metadata>
  <files>
    <file src="..\..\assets\icon.png" target="images\icon.png" />
  </files>
</package>

@augustoproiete
Copy link

@GerryWilko Have you tried using a png icon instead of a jpeg one? I don't often see NuGet packages using jpeg icons (even though it's technically supported in the spec) and I'm wondering if Visual Studio might not support jpeg icons at the moment (either undocumented or bug).

@GerryWilko
Copy link

@augustoproiete Ahh how frustrating. I was thinking yesterday that may have been the issue but discounted it as png, jpg and jpeg are all meant to be supported.

Changed to png and all is working now. Many thanks @augustoproiete
image

Hopefully this will be useful to anyone else experiencing similar issues.

@augustoproiete
Copy link

@GerryWilko Glad you got to the bottom of it. I reported it as a VS Package Manager bug.

@woeterman94
Copy link

woeterman94 commented Oct 20, 2021

It will take a long time for all NuGet servers and clients to catch-up with this feature. For the time being, your best bet is to provide both an embedded icon and an URL icon in the same package as a fallback for any server and client that doesn't yet support the embedded icon.

csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <PackageIcon>images\icon.png</PackageIcon>
    <PackageIconUrl>https://company.com/icon.png</PackageIconUrl>
  </PropertyGroup>
  <ItemGroup>
    <None Include="..\..\assets\icon.png" Pack="true" Visible="false" PackagePath="images\icon.png" />
  </ItemGroup>
</Project>

nuspec

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
  <metadata minClientVersion="3.3">
    <icon>images\icon.png</icon>
    <iconUrl>https://company.com/icon.png</iconUrl>
  </metadata>
  <files>
    <file src="..\..\assets\icon.png" target="images\icon.png" />
  </files>
</package>

I did both, neither of them is working.
image

image

@JobaDiniz
Copy link

Using the solution from @wouterroos works for me. Using Visual Studio 2019 v16.6.0 and the NuGet packages is hosted Azure Artifacts (not that I think the location of the NuGet package matters...)

I'm hosting in the github nuget package and it doesn't show the icon in VS.

@flobernd
Copy link

Same issue for me using VS 2022. Custom NuGet feed is hosted on Azure and no icon is shown. Publishing the same package on nuget.org correctly shows the icon in the VS integrated package manager.

@mekk1t
Copy link

mekk1t commented Apr 28, 2022

The issue persists. We're hosting the feed on Nexus and the embedded icon does not show in Visual Studio NuGet Manager.
I'm using Visual Studio 2022

@TheRealAyCe
Copy link

Related? #9250

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment