quervernetzt
quervernetzt

Reputation: 11621

Azure Functions v2: Integrate Unit Tests with xUnit in Deployment with Azure DevOps

I created an Azure Function v2 (.NET Core) and added a Core Class library that includes Unit Tests using xUnit. I then created a Build pipeline in Azure DevOps with the tasks Visual Studio build and Visual Studio Test.

But I repeatedly fail to build successfully respectively to have the Unit tests running successfully in the pipeline. Locally everything works fine.

What do I have to do to get the Function App build and unit tested successfully in the Azure DevOps Build pipeline?

Upvotes: 0

Views: 779

Answers (1)

quervernetzt
quervernetzt

Reputation: 11621

Here are the steps that have made it work:

<PropertyGroup>
  <TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

to

<PropertyGroup>
  <TargetFramework>netcoreapp2.1</TargetFramework>
  <AzureFunctionsVersion>v2</AzureFunctionsVersion>
  <RuntimeFrameworkVersion>2.1.1</RuntimeFrameworkVersion>
  <PlatformTarget>AnyCPU</PlatformTarget>
  <RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
  • Set up the Build pipeline and include the following tasks:

enter image description here ........................................................ enter image description here ........................................................ enter image description here ........................................................ enter image description here

  • Make sure that all files are added before checking in (TFVC) / pushing (Git)

  • Check in / Push

Upvotes: 1

Related Questions