Search code examples
randomvisual-studio-codeguidvscode-tasks

predefined variable in tasks.json which returns GUID


As a prebuild task, I would like to backup the output file produced by program in earlier debug session. I was thinking if vscode has a predefined variable which creates random string (or guid) to use as filename (or prefix).


Solution

  • In extension Command Variable v1.8.0 is a command that you can use to create a UUID v4 for use in Tasks, Launch and the editor.

    For your tasks.json use the following variable

    ${command:extension.commandvariable.UUID}
    

    See the extension page if you need it in the editor or in a keybinding