首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >AzureDevops和dotnet包:##[错误]没有与搜索模式匹配的文件

AzureDevops和dotnet包:##[错误]没有与搜索模式匹配的文件
EN

Stack Overflow用户
提问于 2020-11-02 03:10:13
回答 2查看 955关注 0票数 1

我有一个项目,我想把它变成一个Azure DevOps CI版本中的NuGet包。解决方案中的相关文件如下所示:

代码语言:javascript
运行
复制
/
    RandExp.sln
        /RandExp
            RandExp.fsproj

        /Tests
            Tests.fsproj

我有一个azure-pipelines.yml文件,如下所示:

代码语言:javascript
运行
复制
trigger:
- ci

pool:
  vmImage: "ubuntu-latest"

variables:
  buildConfiguration: "Release"

steps:
- task: GitVersion@5
  inputs:
    runtime: 'core'
    updateAssemblyInfo: true

- task: DotNetCoreCLI@2
  displayName: "DotNet restore"
  inputs:
    command: 'restore'
- task: DotNetCoreCLI@2
  displayName: "DotNet build $(buildConfiguration)"
  inputs:
    command: 'build'
    arguments: '--configuration $(buildConfiguration) --no-restore'
  
- task: DotNetCoreCLI@2
  displayName: "DotNet test ($(buildConfiguration))"
  inputs:
    command: test
    arguments: '--configuration $(buildConfiguration)'
    
- task: DotNetCoreCLI@2
  displayName: "DotNet pack"
  inputs:
    command: 'pack'
    nobuild: true
    versioningScheme: 'byBuildNumber'

- task: DotNetCoreCLI@2
  displayName: "DotNet push"
  inputs:
    command: 'push'
    packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
    nuGetFeedType: 'external'
    publishFeedCredentials: 'Public Nuget'

一切运行正常,直到倒数第二个任务:DotNet pack[error]No files matched the search pattern出现It错误

代码语言:javascript
运行
复制
Starting: DotNet pack
==============================================================================
Task         : .NET Core
Description  : Build, test, package, or publish a dotnet application, or run a custom dotnet command
Version      : 2.175.0
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/build/dotnet-core-cli
==============================================================================
##[error]No files matched the search pattern.
Info: Azure Pipelines hosted agents have been updated to contain .Net Core 3.x (3.1) SDK/Runtime along with 2.1. Unless you have locked down a SDK version for your project(s), 3.x SDK might be picked up which might have breaking behavior as compared to previous versions. 
Some commonly encountered changes are: 
If you're using `Publish` command with -o or --Output argument, you will see that the output folder is now being created at root directory rather than Project File's directory. To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
Finishing: DotNet pack

我已经用这个错误撞了几个小时了;我已经尝试了我能想到的所有方法,但除了同样的错误之外,我什么也得不到,现在已经放弃了。

值得一提的是,在我的机器上,我可以通过cd进入解决方案的根目录,然后运行dotnet pack,它就能正常工作,生成我期望的nupkg。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-11-02 05:05:13

根据docs,此任务缺少必需的参数

代码语言:javascript
运行
复制
#packagesToPack: '**/*.csproj' # Required when command == Pack
票数 2
EN

Stack Overflow用户

发布于 2021-11-10 20:46:38

在尝试nuget推送时,我在Devops (使用Azure Pipeline代理池)中遇到了基本上相同的问题。packagesToPush的建议路径为:

代码语言:javascript
运行
复制
'$(Build.ArtifactStagingDirectory)/*.nupkg'

将不起作用,等价物也不会与上面接受的答案相同(或与工件分段目录和

代码语言:javascript
运行
复制
/**/*.nupkg 

通配符,带和不带单引号)。

我单击省略号并导航到我的nuget文件,并将文件名更改为通配符,现在它看起来如下所示:

代码语言:javascript
运行
复制
$(System.DefaultWorkingDirectory)/MyPipelineName/drop/*.nupkg

这解决了这个问题。我得到的是"warningNo包与搜索模式匹配“,但当我更改为使用默认工作目录的路径时,它就消失了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64635892

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档