.net core Azure DevOps dotnet测试失败,出现##[错误]错误:进程';C:\ProgramFiles\dotnet\dotnet.exe';失败,退出代码为1

.net core Azure DevOps dotnet测试失败,出现##[错误]错误:进程';C:\ProgramFiles\dotnet\dotnet.exe';失败,退出代码为1,.net-core,azure-devops,azure-functions,.net Core,Azure Devops,Azure Functions,我有AzureDevops管道来构建和测试我的.net核心Azure功能解决方案。本地测试工作正常,但在构建代理上确实失败(我尝试了不同的代理) 以下是错误日志: ##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1 ##[error]Dotnet command failed with non-zero exit code on the following project

我有AzureDevops管道来构建和测试我的.net核心Azure功能解决方案。本地测试工作正常,但在构建代理上确实失败(我尝试了不同的代理)

以下是错误日志:

##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
##[error]Dotnet command failed with non-zero exit code on the following projects : C:\BuildAgent\_work\20\s\UnitTestProject\UnitTestProject.csproj
##[section]Finishing: Test
错误:

这是我的yaml文件:

trigger:
- dev

pool: 'SelfHosted'

variables:
  workingDirectory: '$(System.DefaultWorkingDirectory)/'

steps:
- task: DotNetCoreCLI@2
  displayName: Restore
  inputs:
    command: 'restore'
    projects: '**/*.csproj'
    feedsToUse: 'select'

- task: DotNetCoreCLI@2
  displayName: Build
  inputs:
    command: 'build'
    projects: '**/*.csproj'
    arguments: '--output $(System.DefaultWorkingDirectory)/publish_output --configuration Release'

- task: DotNetCoreCLI@2
  displayName: Test
  inputs:
    command: 'test'
    projects: '**/*.csproj'
    publishTestResults: false

请建议,提前谢谢

当调查上述cs0579重复组装信息错误时。这可能是因为测试过程单独提供了程序集信息,并生成了另一个AssemblyInfo.cs文件,这导致了重复

您可以在下面尝试确保这些程序集信息在项目中只声明一次

1,从项目中删除AssemblyInfo.cs文件以防止复制冲突

2.您可以尝试在.csproj文件中添加以下行

<PropertyGroup>
  <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

假的

请检查此项以获得更多可能的修复

我在使用CI的自动化代码的构建管道中遇到了类似的问题。我使用“.NETCORE”任务来执行测试

解决方案

  • 我将“测试”执行任务从.NETCore切换到“VisualStudio测试”
  • 在“测试文件”下的VSTest任务中,我指定了包含测试用例的确切项目名称。而不是main solution.dll。如图所示

  • 发布包含特定编译错误的其余错误日志。AssemblyInfo源是项目的一部分吗?您是否尝试读取输出中的错误消息?告诉你问题到底是什么的小马?嗨,你试过下面的解决方案了吗?效果如何?