Hi @catmanjan,
- Modify your
.csproj
by replacingAfterTargets="AfterPublish"
withBeforeTargets="AfterPublish"
in theRestartPod
target.
This ensures it executes just before AfterPublish
, which may resolve the issue if AfterPublish
isn't recognized properly.
Here's the .csproj :
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
...snip...
</PropertyGroup>
<Target Name="CustomActionsBeforePublish" BeforeTargets="BeforePublish">
<Exec Command="az acr login -n icognitionhydra" />
</Target>
<Target Name="RestartPod" BeforeTargets="AfterPublish">
<Exec Command="az aks get-credentials -g hydraKubernetes -n hydra" />
<Exec Command="kubectl rollout restart deployment hydra" />
</Target>
</Project>
BeforeTargets="AfterPublish"
ensures the target runs right before AfterPublish
, preventing any execution timing issues.
.
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment