I have an Azure Function v1 that has working build and release pipelines in Azure DevOps. There hasn't been any unit tests yet, until now. Tests run smoothly on my local Visual Studio 2019. But I can't make them run on build pipeline in Azure DevOps.
I am using Visual Studio build, not dotnet.exe, in build pipeline because that is how I've made it work there.
When I try to add dotnet test
, there will be following error:
...\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.
When I try to run tests with Visual Studio Test I get following error:
"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."
What should I do to make my build pipeline run my tests for Azure Function v1?
Microsoft.NET.Test.Sdk
? If so, which version? – rickvdbosch