I am creating a NuGet package and I would like the package to display a notification when an update for the package is present in the repository (this is a private repository, not the official NuGet repository).
Please note: I do not want the package to be automatically updated (in case the new version may cause some problems), but just inform the user about it.
To do this, I added this to my init.ps1file in the package:
param($installPath, $toolsPath, $package, $project)
$PackageName = "MyPackage"
$update = Get-Package -Updates | Where-Object { $_.Id -eq $PackageName }
if ($update -ne $null -and $update.Version -gt $package.Version) {
[System.Windows.Forms.MessageBox]::Show("New version $($update.Version) available for $($PackageName)") | Out-Null
}
Verification is $update.Version -gt $package.Versionnecessary so as not to show a notification when installing a newer package.
I would like to know if
- This solution is acceptable, or if there is a better and βstandardβ way to do it (instead of brewing your own solution).
- ,
MessageBox : " ", , , "".