Azure Pipeline:文件转换任务失败
Azure Pipeline: File Transform task fails
我向构建管道添加了一个文件转换任务。这是管道的一部分:
- task: FileTransform@1
inputs:
folderPath: '$(System.DefaultWorkingDirectory)/**/*.zip'
fileType: 'json'
targetFiles: 'local.settings.json'
- task: DotNetCoreCLI@2
displayName: 'DotNet Build Projects'
inputs:
command: 'build'
projects: '**/*.csproj'
arguments: --configuration $(buildConfiguration)
- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests'
inputs:
command: 'test'
projects: '**/LATICRETE.IdentityFunctions.Tests/*.csproj'
arguments: '--configuration $(buildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(Build.SourcesDirectory)/TestResults/Coverage/'
publishTestResults: true
- script: |
dotnet tool install -g dotnet-reportgenerator-globaltool
reportgenerator -reports:$(Build.SourcesDirectory)/TestResults/Coverage/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/CodeCoverage -reporttypes:HtmlInline_AzurePipelines;Cobertura
displayName: Create Code Coverage Report
- task: PublishCodeCoverageResults@1
displayName: 'Publish Code Coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)/**/coverage.cobertura.xml'
reportDirectory: '$(Build.SourcesDirectory)/TestResults/Coverage/'
- task: DotNetCoreCLI@2
displayName: Publish Function App
inputs:
command: 'publish'
publishWebProjects: false
projects: '**/LATICRETE.IdentityFunctions/*.csproj'
arguments: '--configuration $(buildConfiguration) --output $(build.artifactstagingdirectory)'
zipAfterPublish: True
- task: PublishBuildArtifacts@1
displayName: 'Publish Function Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: 'function'
Azure 中的构建失败并出现以下错误:
##[warning]Can't find loc string for key: Nopackagefoundwithspecifiedpattern
##[error]Error: Nopackagefoundwithspecifiedpattern D:\a\s***.zip
如何解决这个问题?
由于您尝试更改包裹,您的订单有误
- task: FileTransform@1
inputs:
folderPath: '$(System.DefaultWorkingDirectory)/**/*.zip'
fileType: 'json'
targetFiles: 'local.settings.json'
请将您的 folderPath
更改为 local.settings.json 所在的目录,或在 PublishFunctionApp 步骤后移动 FileTransform,但请确保提供正确的路径,因为您将包发布到 $(build.artifactstagingdirectory)
。
我向构建管道添加了一个文件转换任务。这是管道的一部分:
- task: FileTransform@1
inputs:
folderPath: '$(System.DefaultWorkingDirectory)/**/*.zip'
fileType: 'json'
targetFiles: 'local.settings.json'
- task: DotNetCoreCLI@2
displayName: 'DotNet Build Projects'
inputs:
command: 'build'
projects: '**/*.csproj'
arguments: --configuration $(buildConfiguration)
- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests'
inputs:
command: 'test'
projects: '**/LATICRETE.IdentityFunctions.Tests/*.csproj'
arguments: '--configuration $(buildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(Build.SourcesDirectory)/TestResults/Coverage/'
publishTestResults: true
- script: |
dotnet tool install -g dotnet-reportgenerator-globaltool
reportgenerator -reports:$(Build.SourcesDirectory)/TestResults/Coverage/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/CodeCoverage -reporttypes:HtmlInline_AzurePipelines;Cobertura
displayName: Create Code Coverage Report
- task: PublishCodeCoverageResults@1
displayName: 'Publish Code Coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)/**/coverage.cobertura.xml'
reportDirectory: '$(Build.SourcesDirectory)/TestResults/Coverage/'
- task: DotNetCoreCLI@2
displayName: Publish Function App
inputs:
command: 'publish'
publishWebProjects: false
projects: '**/LATICRETE.IdentityFunctions/*.csproj'
arguments: '--configuration $(buildConfiguration) --output $(build.artifactstagingdirectory)'
zipAfterPublish: True
- task: PublishBuildArtifacts@1
displayName: 'Publish Function Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: 'function'
Azure 中的构建失败并出现以下错误:
##[warning]Can't find loc string for key: Nopackagefoundwithspecifiedpattern ##[error]Error: Nopackagefoundwithspecifiedpattern D:\a\s***.zip
如何解决这个问题?
由于您尝试更改包裹,您的订单有误
- task: FileTransform@1
inputs:
folderPath: '$(System.DefaultWorkingDirectory)/**/*.zip'
fileType: 'json'
targetFiles: 'local.settings.json'
请将您的 folderPath
更改为 local.settings.json 所在的目录,或在 PublishFunctionApp 步骤后移动 FileTransform,但请确保提供正确的路径,因为您将包发布到 $(build.artifactstagingdirectory)
。