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?
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?
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://learn.microsoft.com/en-us/nuget/reference/nuspec#icon
<iconUrl>
is now deprecated.
If you have your icon in a GitHub repository, you can locate it on GitHub.com, right click and "Copy image address". Then place this in your .nuspec. This worked for me:
<iconUrl>https://github.com/tcs1896/SharpChecker/blob/master/SharpChecker/SharpChecker/SharpChecker/Icon.png?raw=true</iconUrl>
No, this is the only option using the iconUrl property - See the NuSpec Reference
I would generally choose to host shared images like this on a CDN service rather than TeamCity - CloudFlare provide a free service.
The Documentation is as following
PackageIconUrl is deprecated in favor of the PackageIcon property
Starting with NuGet 5.3 and Visual Studio 2019 version 16.3
So the way to do it is to add the following to your .csproj
<PropertyGroup>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>
<ItemGroup>
<None Include="YOUR_PATH_TO_ICON\icon.png" Pack="true" PackagePath="\" />
</ItemGroup>
You can host icons on your TeamCity server, quoting Orn Kristjansson in TeamCity to serve static HTML page:
It's a Tomcat server, just go on your file system where you installed Teamcity and you should be able to find out where you can park some html that will then be available on the Teamcity urls.
So copy your icons into C:\...\TeamCity\webapps\ROOT\ and the will be served as static files.
I have a work around solution. I tried successfully on windows 10. It is useful if you have to install your application on the offline PC, without internet.
step 1:
add tag to the content of nuspec file. Something like the following:
<metadata>
<id>....</id>
...
<iconUrl>file://C:\app.ico</iconUrl>
...
<copyright>....</copyright>
</metadata>
step 2: generate the nupkg file from the above nuspec
step 3: generate the exe file from nupkg file
step 4:
put the app.ico file at location: C:\app.ico . You can choose any location according to <iconUrl>
in the nuspec file. Almost windows PC have "C" drive disk. So that it is comfortable to install .exe in the other PC if you use "C" drive).
step 5: run exe file to install application on PC.
========= RESULT =============
At C:\Users\"user_name"\AppData\Local\"app_name" you can see the app.ico appears on the installed application folder.
I hope it may help you!
You can add file to nuspec content folder and specify link in such manner: "file://content/images/icon.ico" You can find more info here: Packages containing Icon and License