I'm not that great with Powershell and I'm facing a simple problem. I'm building an automatic Nuget package publish script and for that I need to push the nuget package with a file name like this "Name.version.nupkg". The version number changes so I would need to find a file that matches the patter with changing version number.
Currently the script is a simple script:
cd $PSScriptRoot
dotnet nuget push ..\bin\Debug\MacroFramework.*.nupgk --api-key --source https://api.nuget.org/v3/index.json
$PSScriptRoot is "MacroFrameworkLibrary/Local"
And the output is:
error: File does not exist (..\bin\Debug\MacroFramework.*.nupgk).
Image of the directory content here:
Thanks for the help in advance
EDIT: The final working script is as follows:
cd $PSScriptRoot
$files = Get-ChildItem ..\bin\Debug\MacroFramework.*.nupkg | Sort-Object LastWriteTime -Descending | Select-Object -First 1
foreach ($pgk in $files)
{
dotnet nuget push $pgk.FullName --api-key --source https://api.nuget.org/v3/index.json
}
