我目前正在将VSTS构建管道转换为YAML build definions。但是,我还找不到在YAML文件中使用Variable Group变量的方法。如果像以前一样在构建管道中引用了变量,那么PowerShell脚本似乎无法找到它。
- powershell: |
Write-Output Testing...
Write-Output "DatabaseName: $(AzureSqlDb_DatabaseName)"
displayName: Output Library Vars
详细的错误消息如下:
AzureSqlDb_DatabaseName : The term 'AzureSqlDb_DatabaseName' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At D:\a\_temp\e06f9ee7-8418-4339-a976-ed78a0e71021.ps1:3 char:31
+ Write-Output "DatabaseName: $(AzureSqlDb_DatabaseName)"
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (AzureSqlDb_DatabaseName:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CommandNotFoundException
##[debug]Exit code: 1
##[debug]Leaving Invoke-VstsTool.
##[error]PowerShell exited with code '1'.
如您所见,我已经为构建管道启用了system.debug。所以: