![](/img/trans.png)
[英]Azure DevOps Release pipeline Azure CLI Powershell task can't find powershell
[英]Azure DevOps Release can't find package
我在配置 Azure DevOps 版本以將 ASP.NET 服務推送到本地服務器時遇到問題。
我的管道 yaml 看起來像:
trigger:
- master
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Dev'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: PowerShell@2
inputs:
targetType: inline
script: echo 'building $(solution) to $(Build.ArtifactStagingDirectory)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(Build.ArtifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PowerShell@2
inputs:
targetType: inline
script: echo 'publishing CameraService from $(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'CameraService'
管道成功構建,但我不太了解包/工件的放置位置。 一些教程似乎表明該工作有一個鏈接,但我在 devOps UI 中沒有看到它。
在我的版本中,IIS Web App Deploy 任務失敗並顯示:
No package found with specified pattern.<br/>Check if the package mentioned in the task is published as an artifact in the build or a previous stage and downloaded in the current job.
我正在使用的 Package 或文件夾設置是
$(System.DefaultWorkingDirectory)\**\*.zip
我沒有看到任何可以查看工件以確認它與 Release 中定義的路徑匹配的地方。 任何幫助將不勝感激,謝謝!
*編輯:按要求從分階段的 2 個任務中添加 yaml:
IIS Web 應用管理
steps:
- task: IISWebAppManagementOnMachineGroup@0
displayName: 'IIS Web App Manage'
inputs:
IISDeploymentType: '$(Parameters.IISDeploymentType)'
WebsiteName: '$(Parameters.WebsiteName)'
AddBinding: '$(Parameters.AddBinding)'
Bindings: '$(Parameters.Bindings)'
ParentWebsiteNameForVD: '$(Parameters.WebsiteName)'
VirtualPathForVD: '$(Parameters.VirtualPathForApplication)'
ParentWebsiteNameForApplication: '$(Parameters.WebsiteName)'
VirtualPathForApplication: '$(Parameters.VirtualPathForApplication)'
PhysicalPathForApplication: '%SystemDrive%\inetpub\wwwroot\[*removed for security even tho it's proably ok*]'
AppPoolName: '$(Parameters.AppPoolName)'
IIS Web 應用部署
steps:
- task: IISWebAppDeploymentOnMachineGroup@0
displayName: 'IIS Web App Deploy'
inputs:
WebSiteName: '$(Parameters.WebsiteName)'
TakeAppOfflineFlag: True
XmlVariableSubstitution: True
我沒有看到任何可以查看工件以確認它與 Release 中定義的路徑匹配的地方。
您可以按照我的步驟找到問題的原因並解決。
對於構建管道端:
1.檢查PublishBuildArtifact
任務的日志並確保它確實上傳文件。
2.導航到流水線運行頁面,下載上傳的package查看:
對於經典發布管道(GUI)端:
1.通常我們將構建管道設置為工件源:
將構建管道設置為工件源運行后,該版本將自動從構建管道下載輸出。
2.對於IIS Web App Deploy任務,您可以使用此按鈕查看其內容。
檢查來自構建管道的構建工件是否生成xx.zip
文件。
筆記:
我們需要將構建管道添加為發布管道的工件源(推薦),或者在代理作業中添加download artifact task
,以便我們的發布可以訪問構建工件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.