首页 > 解决方案 > Azure DevOps 管道“dotnet build”找不到项目

问题描述

我有一个存储库,除了自述文件和 azure-pipelines.yml YAML 之外,master 上什么都没有。在开发分支(我要构建和部署并安装 CI 的分支)上有三个文件夹,MVC、Test 和 Console,每个文件夹都包含一个项目(ASP.NET Core MVC 的 MVC 版本、.NET Core 控制台和 Xunit 测试项目)。我想dotnet restore在 MVC 项目上运行和构建,但出现错误:

2019-02-08T15:09:20.9373945Z ##[section]Starting: CmdLine
2019-02-08T15:09:20.9468192Z ==============================================================================
2019-02-08T15:09:20.9468291Z Task         : Command Line
2019-02-08T15:09:20.9468353Z Description  : Run a command line script using cmd.exe on Windows and bash on macOS and Linux.
2019-02-08T15:09:20.9468441Z Version      : 2.146.1
2019-02-08T15:09:20.9468490Z Author       : Microsoft Corporation
2019-02-08T15:09:20.9468565Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
2019-02-08T15:09:20.9468629Z ==============================================================================
2019-02-08T15:09:22.4499876Z Generating script.
2019-02-08T15:09:22.5206191Z ##[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\21484123-df40-47c7-9383-7f526daaa124.cmd""
2019-02-08T15:09:22.8173263Z MSBUILD : error MSB1009: Project file does not exist.
2019-02-08T15:09:22.8173430Z Switch: MVC
2019-02-08T15:09:23.1247189Z Microsoft (R) Build Engine version 15.9.20+g88f5fadfbe for .NET Core
2019-02-08T15:09:23.1308513Z Copyright (C) Microsoft Corporation. All rights reserved.
2019-02-08T15:09:23.1308642Z
2019-02-08T15:09:23.1308714Z MSBUILD : error MSB1009: Project file does not exist.
2019-02-08T15:09:23.1308801Z Switch: MVC
2019-02-08T15:09:23.2993350Z ##[error]Cmd.exe exited with code '1'.
2019-02-08T15:09:23.3158684Z ##[section]Finishing: CmdLine

master 中的 YAML 文件如下:

# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- dev
- master

pool:
  vmImage: 'vs2017-win2016'

#- task: DotNetCoreInstaller@0
#  inputs:
#    version: '2.2.103' # replace this value with the version that you need for your project

steps:
- script: |
    dotnet restore MVC
    dotnet build MVC
- task: PublishBuildArtifacts@1

- script: |
    echo Add other tasks to build, test, and deploy your project.
    echo See https://aka.ms/yaml
  displayName: 'Run a multi-line script'

- task: PublishBuildArtifacts@1

有没有办法访问 MVC 的dotnet命令?

标签: .net-coreazure-devops

解决方案


推荐阅读