首页 > 解决方案 > Reusing PowerShell Scripts in Azure DevOps

问题描述

I have a PowerShell script that I want to re-use across multiple build pipelines. My question is, is there a way I can "store" or "save" my PowerShell script at the project or organization scope so that I can use it in my other build pipelines? If so, how? I can't seem to find a way to do this. It would be super handy though.

标签: azure-devopsazure-pipelines

解决方案


根据这些脚本的大小,您可以创建包含 powershell 任务的任务组,其中脚本为 inline-powershell。但这仅适用于项目范围..

我尝试的另一种尝试是创建一个包含您的 powershell 脚本的存储库,将此存储库作为子模块添加到您尝试构建的存储库中,然后从子模块文件夹中调用脚本。但这仅在使用 git-repos 时有效。

或者您可以创建一个包含您的脚本的自定义构建任务。


推荐阅读