如何在“dotnet run”构建步骤

时间:2017-10-23 13:29:20

标签: .net-core azure-devops

这是我的构建步骤

enter image description here

这是生成的日志

2017-10-23T12:46:42.8958745Z ##[section]Starting: dotnet run Tools
2017-10-23T12:46:42.8958745Z ==============================================================================
2017-10-23T12:46:42.8958745Z Task         : .NET Core
2017-10-23T12:46:42.8958745Z Description  : Build, test and publish using dotnet core command-line.
2017-10-23T12:46:42.8958745Z Version      : 1.0.2
2017-10-23T12:46:42.8958745Z Author       : Microsoft Corporation
2017-10-23T12:46:42.8958745Z Help         : [More Information](https://go.microsoft.com/fwlink/?linkid=832194)
2017-10-23T12:46:42.8958745Z ==============================================================================
2017-10-23T12:46:43.3968589Z [command]"C:\Program Files\dotnet\dotnet.exe" run d:\a\1\s\Tools\Tools.csproj --configuration test
2017-10-23T12:46:43.5008554Z Couldn't find a project to run. Ensure a project exists in d:\a\1\s, or pass the path to the project using --project.
2017-10-23T12:46:43.5138548Z ##[error]Error: C:\Program Files\dotnet\dotnet.exe failed with return code: 1
2017-10-23T12:46:43.5138548Z ##[error]Dotnet command failed with non-zero exit code on the following projects : d:\a\1\s\Tools\Tools.csproj
2017-10-23T12:46:43.5168542Z ##[section]Finishing: dotnet run Tools

问题是,任务运行的项目不会通过--project参数传递。但是如何使用构建步骤提供的选项来做到这一点?

1 个答案:

答案 0 :(得分:3)

假设你有一个.Net Core控制台应用程序与Git仓库中的以下内容一起存储:

column.isDynamic()

使用.net运行它,为.Net Core任务提供以下参数:

  • 命令:运行
  • 项目:* .csproj
  • 参数-p temp.csproj

这是一个示例输出:

reporoot/ reporoot/Program.cs reporoot/temp.csproj