I managed to combine $ (ProjectDir) and $ (PublishDir) to get the publication folder. However, I published the SharePoint application, but I think it should work for other cases.
For example, to call a program
<Exec Command=""$(ProjectDir)\app.exe" "$(ProjectDir)$(PublishDir) ""/>
source share