【发布时间】:2020-08-04 19:06:40
【问题描述】:
我在配置 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.
我使用的包或文件夹设置是
$(System.DefaultWorkingDirectory)\**\*.zip
我没有看到任何可以查看工件以确认它与发布中定义的路径匹配的地方。任何帮助将不胜感激,谢谢!
*编辑:按请求从分阶段的 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
【问题讨论】:
-
显示您的版本的完整 YAML。如果您使用单独的管道进行部署,则必须告诉该管道从哪里检索构建工件。
-
@DanielMann 谢谢丹尼尔,我已经用可以从 devOps UI 中找到的 yaml 更新了问题,希望对您有所帮助。
-
您的发布阶段是在 yaml 文件中定义还是经典版本(即在 Azure DevOps GUI 中定义)?如果它是经典版本,您是否添加了任何构建工件?
-
@NickGraham 我是 devOps 自动化的新手,所以我猜测它是经典的,因为我通过了 GUI。我看不到进入舞台定义的方法,但我会用谷歌搜索。感谢您的领导!
-
这应该给你一个很好的起点 - docs.microsoft.com/en-us/azure/devops/pipelines/release/…
标签: azure azure-devops