我有一个正在构建的 Azure Devops 部署管道设置,我能够毫无问题地部署到自托管虚拟机。
我有以下 powershell 脚本可以正确清除我的目标目录,留下 2 个不属于源代码控制的文件夹
Get-ChildItem -Path 'C:\inetpub\wwwroot\testDeploy\' -Recurse -exclude "pod","photos" |
Select -ExpandProperty FullName |
Where {$_ -notlike '*\pod\*' -and $_ -notlike '*\photos\*'} |
sort length -Descending |
Remove-Item -force
我尝试添加“PowerShell 脚本”任务,但我不知道如何将 PowerShell 脚本放入任务可以访问的文件夹中,即 $(System.DefaultWorkingDirectory)。谁能建议我应该如何生成文件或将其存储在我的存储库中,然后自托管 Windows 代理可以访问