JLo*_*JLo 11 .net-core azure-devops azure-pipelines-build-task
我在配置Azure DevOps Dotnet核心生成过程时遇到问题。
我有一个简单的dotnet核心项目,正在尝试在Azure DevOps环境中进行构建。
该项目位于我的仓库内的子文件夹中,但是我无法弄清楚如何指定管道应如何找到我的csproj文件。 MSDN文档建议您可以指定它,但没有示例,我的所有尝试都遇到错误。
使用标准dotnet CLI模板构建管道时,创建的YAML为:
# ASP.NET Core
# Build and test ASP.NET Core web applications targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/vsts/pipelines/languages/dotnet-core
pool:
  vmImage: 'Ubuntu 16.04'
variables:
  buildConfiguration: 'Release'
steps:
- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'
但是,遇到错误:
MSBUILD : error MSB1003: Specify a project or solution file. 
The current working directory does not contain a project or solution file.
上面链接的文档建议使用基于“任务”的语法而不是脚本,并且我假设在文档中,输入内容的输入顺序与下面的示例相同。
Sha*_*zyk 13
如果使用,script请在build单词后指定csproj文件:
- script: dotnet build myrepo/test/test.csproj --configuration $(buildConfiguration)
使用Azure DevOps管道的最佳方法是将任务用于构建管道,在Dotnet Core yaml构建任务中,您可以在以下inputs部分中指定文件:
- task: DotNetCoreCLI@2
  inputs:
    command: 'build' 
    projects: 'myrepo/test/test.csproj'
| 归档时间: | 
 | 
| 查看次数: | 4950 次 | 
| 最近记录: |