下面的 YAML 片段似乎没有按预期工作。
我在使用 Windows 最新镜像运行的管道中配置了它,它尝试恢复存储库中的所有项目,而不是仅查看解决方案文件。
此外,它似乎完全忽略了 --no-restore 标志
- task: DotNetCoreCLI@2
displayName: Package to Staging directory
inputs:
command: pack
configuration: $(BUILD_CONFIGURATION)
projects: 'support-libs.sln'
packDirectory: $(Build.ArtifactStagingDirectory)
nugetConfigPath: 'sf-solution/nuget.config'
arguments: '--no-restore'
verbosityRestore: Minimal
步骤日志中显示的命令是:
"C:\Program Files\dotnet\dotnet.exe" pack d:\a\1\s\sf-solution\SampleProject\SampleProject.csproj --output d:\a\1\a /p:Configuration=Debug --verbosity Detailed
上述项目甚至没有包含在代码段配置的 support-libs SLN 文件中。
最佳答案
The above project is not even included in the support-libs SLN file the snippet has configured
不知道为什么 DotNetCLI 任务打包该项目,该项目未包含在支持库 SLN 中。由于您没有在问题中共享项目文件结构和构建日志,因此我无法向您提供此问题的直接原因。
但作为解决方法,您可以指定特定的项目文件而不是解决方案文件。此外,您还可以通过经典编辑器查看此任务:
它指出要打包的csproj 或 nuspec 文件的路径。
对于忽略配置输入问题,有一个选项不构建,因此,您可以将此参数添加到您的打包任务中,而不是参数--no-restore
:
- task: DotNetCoreCLI@2
displayName: 'dotnet pack'
inputs:
command: pack
packagesToPack: YourProjectPath&Name.csproj
nobuild: true
注意:在使用此包任务之前添加 DotNet 构建任务。
希望这有帮助。
关于azure-devops - DotNetCLI@2 包似乎忽略了配置输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59171961/