问题
Using agent-based release templates, not vNext, how do I configure a "Create Folder" item so that it incorporates the date into the folder name, e.g. "C:\inetpub\wwwroot\backups\MyApp\02-03-2015\".
Preferably, I would like the build number instead of the date but I believe it's only available to vNext templates. -edit- unless you're using components
I'm trying to implement some backup and rollback logic as part of the my release pipeline. I want to copy the existing web code to a backup folder, just in case the copy from the drop location to the web server fails. On rollback, I'll copy from my backup, to the server. I've seen the build to Test fail when someone tampers with the files, presumably because the security is missing the RM service account.
Alternative solutions that solve the problem may be accepted as well. I'd like to keep successive backup foldcers and have them deleted manually. I do NOT want to reuse the same folder for backup and restore.
回答1:
As long as you are using a component $(BuildNumber) will work in agent-based templates. To create a folder you would create a component based on Windows Common IO and when you use it in the Release Template the Action = Create and FileFolderName = C:\inetpub\wwwroot\backups\MyApp\$(BuildNumber).
来源:https://stackoverflow.com/questions/28308290/how-to-create-a-folder-with-a-date-or-build-number-using-agent-based-template-in