79522334

Date: 2025-03-20 08:47:19
Score: 0.5
Natty:
Report link

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>
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Alejandro Conde