I'm trying to make a post-build event that zip release files with a timestamp as a part of folder name. I am creating zip file like this:
if $(ConfigurationName) == Release (powershell Compress-Archive -Path '$(ProjectDir)$(OutDir)' -DestinationPath '$(ProjectDir)bin\MyFile.zip' -Force)
Now I have zip file named "MyFile.zip" but I want it to have date in its name, like "04.12.2020.MyFile.zip".
Does anyone have any idea how to do that?
You could try using MSBuild property functions.
This is modified build step:
if $(ConfigurationName) == Debug (powershell Compress-Archive -Path '$(ProjectDir)$(OutDir)' -DestinationPath '$(ProjectDir)bin\MyFile_$([System.DateTime]::Now.Year)-$([System.DateTime]::Now.Month)-$([System.DateTime]::Now.Day).zip' -Force)
You can tweak it to have desired format.