So, after looking for alternatives for a while and checking the log for the publishing I found that before the final published files are moved to the Applications Files
folder in the PublishUrl
, the structure is replicated inside the PublishDir
and deleted once moved to the final destination. Therefore, when doing any action during an "AfterTargets="Publish"
target, if trying to act upon the .deploy
files any command must point to the $(PublishDir)Application Files\...
contents.
My final solution was something like the code shown bellow. The "replaces" are in place so that one can get the version-revision string in a "MyApp_X_X_X_X"
format.
<Target Name="ExecuteSomething" AfterTargets="Publish" Condition="'$(Configuration)' == 'Release'">
<Exec Command='"Path\To\Something.exe"; "$(ProjectDir)$(PublishDir)Application Files\$(AssemblyName)_$(ApplicationVersion.Replace(.,_).Replace(*,$(ApplicationRevision)))\MyApp.dll.config.deploy"'/>
</Target>