CommandTaskRunner icon indicating copy to clipboard operation
CommandTaskRunner copied to clipboard

Variable values are outdated

Open shindai opened this issue 6 years ago • 0 comments

Installed product versions

  • Visual Studio: 2017 Professional
  • This extension: 1.3.50

Description

If I add a simple powershell script, which only outputs the arguments, I added before, mentioned here: https://github.com/madskristensen/CommandTaskRunner/pull/13

Steps to recreate

  1. Create new solution with empty project
  2. Add command file to solution { "commands": { "example0": { "fileName": "powershell.exe", "workingDirectory": ".", "arguments": "-ExecutionPolicy Bypass -NonInteractive -File example.ps1 \"$(ConfigurationName)\" \"$(DevEnvDir)\" \"$(SolutionDir)\" \"$(ProjectDir)\"" } }
  3. add example.ps1 to solution param ( [String]$ConfigurationName, [String]$DevEnvDir, [String]$SolutionDir, [String]$ProjectDir ) Write-Output "Configuration: $ConfigurationName" Write-Output "DevEnvDir: $DevEnvDir" Write-Output "SolutionDir: $SolutionDir" Write-Output "ProjectDir: $ProjectDir"

Current behavior

If I switch from debug to release, the variable is not updated, it still contains "debug". Also the current project and many more.

Expected behavior

I expect that the variables are up 2 date when the script is running and the configurationName should contain "release", when the current build configuration is "release".

I debugged the extension and saw, that the variables are "compiled" into the task configuration and not updated again, when the task is starting. Only when the file is changed.

It is possible to change that?

I tried to understand it a little bit and it seems that somehow VS catches up the task runner configuration, which contains the complete file. And it runs it when I click on in in the task runner. There is only one hook, when the commands file changes, there is the possibility to update the configuration.

When you cannot update it right before the task is gonna run, maybe it's possible to invalidate/update it when one of the Environment Variables will change (e.g. switch build configuration ...)

shindai avatar Apr 14 '19 20:04 shindai