From 169c205115e78650f5b889d1a861be0160d15369 Mon Sep 17 00:00:00 2001 From: Kevin Bost Date: Wed, 20 Aug 2025 00:28:36 -0700 Subject: [PATCH] Embeds icon into NuGet packages Updates NuGet packages to embed an icon, instead of referencing an icon URL. This change improves the NuGet package display and provides a more consistent user experience. It removes the need to download the icon separately and ensures the icon is always available, even if the URL becomes invalid. --- build/BuildNugets.ps1 | 26 ------------------ build/MaterialDesign.Icon.png | Bin 0 -> 2181 bytes .../MaterialDesignColors.nuspec | 3 +- .../MaterialDesignThemes.MahApps.nuspec | 3 +- .../MaterialDesignThemes.nuspec | 3 +- 5 files changed, 6 insertions(+), 29 deletions(-) create mode 100644 build/MaterialDesign.Icon.png diff --git a/build/BuildNugets.ps1 b/build/BuildNugets.ps1 index c59e7d9816..d398eb4dc6 100644 --- a/build/BuildNugets.ps1 +++ b/build/BuildNugets.ps1 @@ -8,31 +8,6 @@ $year = [System.DateTime]::Now.ToString("yyyy") $copyright = "Copyright $year James Willock/Mulholland Software Ltd" $configuration = "Release" -function Update-Icon { - param ( - [string]$Path - ) - $Path = Resolve-Path $Path - [xml] $xml = Get-Content $Path - [string] $iconUrl = $xml.package.metadata.iconUrl; - if (![string]::IsNullOrWhiteSpace($iconUrl) -and [string]::IsNullOrWhiteSpace($xml.package.metadata.icon)) { - $nugetIconFile = "$($xml.package.metadata.id).Icon.png"; - $nugetIconPath = Join-Path (Split-Path $Path -Parent) $nugetIconFile - Write-Host "Downloading icon from $iconUrl to $nugetIconPath" - Invoke-WebRequest $iconUrl -OutFile "$nugetIconPath" - $files = $xml.SelectSingleNode("/package/files") - $iconFile = $xml.CreateElement("file") - $iconFile.SetAttribute("src", "$nugetIconFile") - $iconFile.SetAttribute("target", "images\") - $files.AppendChild($iconFile) | Out-Null - - $iconElement = $xml.CreateElement("icon") - $iconElement.InnerText = "images\$nugetIconFile" - $xml.package.metadata.AppendChild($iconElement) | Out-Null - } - $xml.Save($Path) -} - function Update-Versions { param ( [string]$Path @@ -58,7 +33,6 @@ function New-Nuget { ) $NuSpecPath = Resolve-Path $NuSpecPath - Update-Icon "$NuSpecPath" nuget pack "$NuSpecPath" -version "$Version" -Properties "Configuration=$configuration;Copyright=$copyright" } diff --git a/build/MaterialDesign.Icon.png b/build/MaterialDesign.Icon.png new file mode 100644 index 0000000000000000000000000000000000000000..6050e05cf7be4819d2e9452752ac4ca316e5c31e GIT binary patch literal 2181 zcmV;02zvL4P)5DhN`kZAvuS76~=A+BBvbV``<1 zHEFeJ(+5^fqt-OFl{V3cHW*Wg#FhmW0bL(O-GxO#mSqu^UD(;3otZoLo?ri%+1=Tf ztv$)jIrrq8^ZlOR>->IldCS2m=`eaURF&wm& z5C>^V5#8Y)&xel=T6^QrqVkOjsE!M4>v9!TM=Sm z$VErGxvhCG@j}F3mM&oD*$wo^J&gTqMBIshwCwifM%3rW_*z>B_dLIo1&2OCB8#Fd zdHX{SoH>QZu3g067B%5#gOa}WQ`H9`XS}knOQC^Dz^#B$IQ#f%?tkHRmhIV3CKem* z1EnsR3wZy$S=_yLIq#i0g}f1r>coax`jKg436z0nVlMN$`*`4)?OeM5D6vcqO~lb$ z03zcEpo+0dI%y z$h-#X-*^zWX(r-(5ZUpDWdw;V7quVdUqAUP&pfe(#-21Pg39RI1IUyeZCyZv0)bY$nEDjng=dl5vonS;$OcQlk)MuwVd#y zV@S-U|L!Mo=Fg_kasa{z#Ec1j#a^tEw3df&xPtX77cv-giv;Snw{;;j)Sn(;%g;72 zHGsg8A!{tROb9KK^pL6qRS(`u)Y$_fi0_eEzX@+~6S=?dhA;%jjFz>6XCW8nSoPx@ z*gO9mR28Y+UQ&SwWHbD9<2G)5uM4+7kC-vHDK|Q+n1)&^f4&yN2xsJT&v0=zf?I+lt7chcUHn(;G4F;tt%5iIbjO*skz%3MAEYyf>TL;+< z&D1p?z>UX>98||gmmmbIoVfT5r=f`+dCMZ6S5EAE(@x6(TJC4Hcxnw}kp@ z7EuxNi|V(Q%#lwx^~fepg&v2#aTQ_GFJ%RSq)HN)*^}m_UvH#3JxD=>f&+t}n?dy5 ztEjtd0g^9(F%*J4gKxG|_~Xk|zte>=hEr!%5#G9t)Y1z{)>L6sAnwxJc98tzTc~*B zFv%Rm6oN#I)pxGq^`_ZH4nqXQM%?`3E8M=Ljk;`v5kY_;EYQ2MiK^RI;ZLhYj6r~c zD7|~z2{TzLFFc!6GKCSrs*>;R0e5Vl5e4;PmQ+>{xLLcg3nf3{EL@4il(zgstb)(cl_F5eCv}GQWDBx;-7Z z*|4ZDg+VRQfAi(ktXYm*T>%JDCdvR}893=oxy>p91$@OWmAV_{Jfx z%8K@04g^Ibmt=`R66GFefZNWQh4o@Ys#r(JwjUw;+)h#(TS&%ztbi6mvQsO_UeG|~ z2+qD^R2@m+giJjVjwD5 z%k0h%d1%2LE;`4~R z9;i~Vmi;}a_~E`|{M)ZW63O9YMH1Uuha=(elYG3Bg>J+hv!-(Wyg6hMED)(>@SP9I zKh;c4^L}EgT|9Cu&1?7sei9>w@&sNI+dk+5 zX`n2HLV%Me2!cF|O~`L9n#a7l8eC(F@49Q~+4Da3(X9}K1Zx*jd-WHJzORZ^r87Oi z1FeVIEJ-9)H74I22_oWe`(Ts=%EPSo^n-(3YX2CPSz?a5TRJLI4T$f z-!bez-p%^M-Mk#Q^d(Y=>yCOAbxejhiok@)W8bObHZcT2z#89j?}A3Ar;-?vqRLe1 z&E`Fi1@u7&Gp?vEZs8@yR4mzA4jROyZ3p0&1cHU#W0dTc5%cc%eJZi-XEh zzXHdLm1?2?4h|C#(8=nb!T#Yl17lEeuwfn|#rQtB-tf|~1SSJ7)&;6k%y1`>fR<<_ zQV`@yax)-c;)&8&hN~q$130P}$>rXf2z2Nh)nYyvrJames Willock MIT https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit - http://materialdesigninxaml.net/images/MD4XAML32.png + images\MaterialDesign.Icon.png false ResourceDictionary instances containing standard Google Material Design swatches, for inclusion in a XAML application. @@ -23,6 +23,7 @@ + diff --git a/src/MaterialDesignThemes.MahApps/MaterialDesignThemes.MahApps.nuspec b/src/MaterialDesignThemes.MahApps/MaterialDesignThemes.MahApps.nuspec index bdd981bb4a..59de5d8666 100644 --- a/src/MaterialDesignThemes.MahApps/MaterialDesignThemes.MahApps.nuspec +++ b/src/MaterialDesignThemes.MahApps/MaterialDesignThemes.MahApps.nuspec @@ -8,7 +8,7 @@ James Willock MIT https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit - http://materialdesigninxaml.net/images/MD4XAML32.png + images\MaterialDesign.Icon.png false ResourceDictionary instances containing Material Design templates and styles for WPF controls in the MahApps library. @@ -30,6 +30,7 @@ + diff --git a/src/MaterialDesignThemes.Wpf/MaterialDesignThemes.nuspec b/src/MaterialDesignThemes.Wpf/MaterialDesignThemes.nuspec index 6dac8e637c..3a13eb86e8 100644 --- a/src/MaterialDesignThemes.Wpf/MaterialDesignThemes.nuspec +++ b/src/MaterialDesignThemes.Wpf/MaterialDesignThemes.nuspec @@ -8,7 +8,7 @@ James Willock MIT https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit - http://materialdesigninxaml.net/images/MD4XAML32.png + images\MaterialDesign.Icon.png false ResourceDictionary instances containing Material Design templates and styles for WPF controls in .NET. @@ -28,6 +28,7 @@ +