我有一个Azure Function v1,在Azure DevOps中具有有效的生成和发布管道。到目前为止,还没有任何单元测试。测试可以在本地Visual Studio 2019上顺利运行。但是我无法使它们在Azure DevOps中的构建管道上运行。
我在构建管道中使用的是Visual Studio构建,而不是dotnet.exe,因为这就是我在这里工作的方式。
当我尝试添加dotnet test
时,会出现以下错误:
...\Roslyn\Microsoft.CSharp.Core.targets(59,5): error MSB4062: The "Microsoft.CodeAnalysis.BuildTasks.Csc"
task could not be loaded from the assembly ...\Roslyn\Microsoft.Build.Tasks.CodeAnalysis.dll.
Assembly with same name is already loaded Confirm that the <UsingTask> declaration is correct,
that the assembly and all its dependencies are available, and that the task contains
a public class that implements Microsoft.Build.Framework.ITask.
当我尝试使用Visual Studio Test运行测试时,出现以下错误:
"An exception occurred while invoking executor 'executor://mstestadapter/v2':
Method 'get_DataRow' in type 'Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.TestContextImplementation'
from assembly 'Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices,
Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' does not have an implementation."
我应该怎样做才能使构建管道运行Azure Function v1的测试?