Handle icon from both sources:
The PM UI should be able to show packages with both icon types, transparent from the user
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!
I've the same problem as described by @wouterroos
Same issue here!
Still experiencing it. Please, add that feature.
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...)
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.
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.
@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
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.
<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>
<?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>
Most helpful comment
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:
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!