I'm trying to set up deployment for my .Net Core console application using Octopus Deploy. My original idea was to kill an old version's process by name before launching a new version but the problems is all the .Net Core processes are called "dotnet"... Is there a way to kill a .Net Core process by the name of dll?
Use PowerShell
:
$process = Get-Process | where {$_.Name -eq 'dotnet' -and $_.modules.ModuleName -eq 'test.dll'}
if ($process) {
$process | Stop-Process -Force
}