【发布时间】:2020-07-18 11:55:10
【问题描述】:
我在部署到 IIS 时遇到错误:
2020-04-06T10:51:49.9302914Z ##[error]Error: 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
作为 IIS Web App Deploy 任务中的包文件夹,首先我收到错误消息,我通过选择文件夹位置更改了文件夹:
$(System.DefaultWorkingDirectory)/_MyProject-ASP.NET-CI
但它没有任何帮助。错误保持不变。
这是我的 YAML:
steps:
- task: IISWebAppDeploymentOnMachineGroup@0
displayName: 'IIS Web App Deploy'
inputs:
WebSiteName: '$(Parameters.WebsiteName)'
VirtualApplication: dev.myproject.com
Package: '$(System.DefaultWorkingDirectory)/_MyProject-ASP.NET-CI'
ExcludeFilesFromAppDataFlag: true
TakeAppOfflineFlag: True
XmlTransformation: true
XmlVariableSubstitution: True
发布工件任务如下:
steps:
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: '$(Parameters.ArtifactName)'
condition: succeededOrFailed()
我的构建中还有一个复制文件任务:
steps:
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
在发布工件任务之前。
我已经寻找过类似的问题,但只找到了这样的解决方案:Azure DevOps pipeline release Error: No package found with specified pattern: D:\a\r1\a\**\*.zip 这不相关,因为我的 YAML 看起来像是在提供建议,并且我已经提到了复制文件任务。
此阶段的完整日志:
2020-04-06T10:51:48.3476113Z ##[section]Starting: IIS Web App Deploy
2020-04-06T10:51:48.3785215Z ==============================================================================
2020-04-06T10:51:48.3786130Z Task : IIS web app deploy
2020-04-06T10:51:48.3786911Z Description : Deploy a website or web application using Web Deploy
2020-04-06T10:51:48.3787618Z Version : 0.156.9
2020-04-06T10:51:48.3788205Z Author : Microsoft Corporation
2020-04-06T10:51:48.3789263Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/iis-web-app-deployment-on-machine-group
2020-04-06T10:51:48.3790410Z ==============================================================================
2020-04-06T10:51:49.9302914Z ##[error]Error: 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.
2020-04-06T10:51:49.9420801Z ##[section]Finishing: IIS Web App Deploy
我想不出这是什么!
我是新发布的,所以我完全不确定还有什么遗漏或者我是否设置正确。
编辑
这是完整的构建 YAML:
pool:
name: Azure Pipelines
demands:
- msbuild
- visualstudio
steps:
- task: NuGetToolInstaller@0
displayName: 'Use NuGet 4.4.1'
inputs:
versionSpec: 4.4.1
- task: NuGetCommand@2
displayName: 'NuGet restore'
inputs:
restoreSolution: '$(Parameters.solution)'
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3
displayName: 'Use Yarn 1.22.1'
inputs:
versionSpec: 1.22.1
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-task.Yarn@3
displayName: 'Yarn install'
inputs:
projectDirectory: Web
arguments: install
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-task.Yarn@3
displayName: 'Yarn build'
inputs:
projectDirectory: Web
arguments: build
- task: VSBuild@1
displayName: 'Build solution'
inputs:
solution: '$(Parameters.solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\\"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
- task: VSTest@2
displayName: 'Test Assemblies'
inputs:
testAssemblyVer2: |
**\$(BuildConfiguration)\*test*.dll
!**\obj\**
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
enabled: false
- task: PublishSymbols@2
displayName: 'Publish symbols path'
inputs:
SearchPattern: '**\bin\**\*.pdb'
PublishSymbols: false
continueOnError: true
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: '$(Parameters.ArtifactName)'
condition: succeededOrFailed()
编辑 2
VSBuild 任务的日志:
2020-04-07T15:37:05.6665411Z ##[section]Starting: Build solution
2020-04-07T15:37:05.7033615Z ==============================================================================
2020-04-07T15:37:05.7034084Z Task : Visual Studio build
2020-04-07T15:37:05.7034450Z Description : Build with MSBuild and set the Visual Studio version property
2020-04-07T15:37:05.7034755Z Version : 1.166.0
2020-04-07T15:37:05.7034990Z Author : Microsoft Corporation
2020-04-07T15:37:05.7035347Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/visual-studio-build
2020-04-07T15:37:05.7036406Z ==============================================================================
2020-04-07T15:37:13.7071155Z ##[command]"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.166.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -latest -format json
2020-04-07T15:37:13.7989257Z ##[command]"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.166.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [16.0,17.0) -products Microsoft.VisualStudio.Product.BuildTools -latest -format json
2020-04-07T15:37:13.8796977Z ##[command]"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.166.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -latest -format json
2020-04-07T15:37:14.2358042Z ##[command]"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" "D:\a\1\s\myproject.com.sln" /nologo /nr:false /dl:CentralLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.166.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=0ce4c4e1-c2fb-42a2-b03b-860f664e3238|SolutionDir=D:\a\1\s"*ForwardingLogger,"D:\a\_tasks\VSBuild_71a9a2d3-a98a-4caa-96ab-affca411ecda\1.166.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="D:\a\1\a\\" /p:platform="any cpu" /p:configuration="release" /p:VisualStudioVersion="15.0" /p:_MSDeployUserAgent="VSTS_ec7516ed-027d-4f0f-95e9-525fa5443e34_build_6_0"
2020-04-07T15:37:14.3407720Z Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
2020-04-07T15:37:14.3741342Z Build started 4/7/2020 3:37:14 PM.
2020-04-07T15:37:14.5565930Z ##[warning]D:\a\1\s\myproject.com.sln.metaproj(0,0): Warning MSB4126: The specified solution configuration "release|any cpu" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration.
2020-04-07T15:37:14.5685931Z Project "D:\a\1\s\myproject.com.sln" on node 1 (default targets).
2020-04-07T15:37:14.5693512Z D:\a\1\s\myproject.com.sln.metaproj : warning MSB4126: The specified solution configuration "release|any cpu" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration. [D:\a\1\s\myproject.com.sln]
2020-04-07T15:37:14.5773938Z Done Building Project "D:\a\1\s\myproject.com.sln" (default targets).
2020-04-07T15:37:14.5806168Z
2020-04-07T15:37:14.5806758Z Build succeeded.
2020-04-07T15:37:14.5931062Z
2020-04-07T15:37:14.5943625Z "D:\a\1\s\myproject.com.sln" (default target) (1) ->
2020-04-07T15:37:14.5945416Z (ValidateSolutionConfiguration target) ->
2020-04-07T15:37:14.5948111Z D:\a\1\s\myproject.com.sln.metaproj : warning MSB4126: The specified solution configuration "release|any cpu" is invalid. Please specify a valid solution configuration using the Configuration and Platform properties (e.g. MSBuild.exe Solution.sln /p:Configuration=Debug /p:Platform="Any CPU") or leave those properties blank to use the default solution configuration. [D:\a\1\s\myproject.com.sln]
2020-04-07T15:37:14.5952737Z
2020-04-07T15:37:14.5952959Z 1 Warning(s)
2020-04-07T15:37:14.5953123Z 0 Error(s)
2020-04-07T15:37:14.5954912Z
2020-04-07T15:37:14.5955667Z Time Elapsed 00:00:00.20
2020-04-07T15:37:14.6534792Z ##[section]Finishing: Build solution
【问题讨论】:
-
你能把你的完整 YAML 文件放上去吗?我想知道你的任务是按什么顺序完成的。
-
@Krzysztof 我已经在上面展示了 IIS Web App Deploy
YAML。我现在已经粘贴了完整版本的 YAML。虽然我不确定复制文件是否应该存在于构建中,因为现在所有构建都需要很长时间 -
复制整个源目录。对我来说这是一个错误。而且您已经将您的包发布到 ArtifactStagingDirectory。我建议您删除 CopyFiles 任务并在 PublishBuildArtifact 添加 powershell 任务(将其放在任务之后:VSBuild@1 任务之后)以检查 ArtifactStagingDirectory 中的内容。 - 任务:PowerShell@2 输入:targetType:'inline' 脚本:ls '$(build.artifactstagingdirectory)'
-
@Krzysztof 我已经做到了,不知道它应该做什么?另外,如果我不复制文件,我会在构建时收到
##[warning]Directory 'D:\a\1\a' is empty. Nothing will be added to build artifact 'drop'.警告,这也可能是我的错误的根源。 -
您是否验证了构建实际上正在正确发布?
标签: azure-devops azure-pipelines web-deployment azure-pipelines-release-pipeline azure-artifacts