'Integration tests with reference to MS Access Engine on Azure DevOps

I have some integration tests and the problem is that they require Microsoft Access Database Engine 2010 Redistributable to be installed on a machine so in Azure Pipelines tests just fail because cannot find it.

MS Access Engine is needed to create a connection to Excel files and query them.

connectionStr = $"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={path};Extended Properties=Excel 12.0 XML;"

I need advice how to overcome this problem. There are just a couple of ideas:

  • Find some dll that will allow executing tests without Access Engine Installed (as I understood this won't work because the Provider should be registered in the system)
  • Create a VM with MS Access Engine installed (I'd like a simpler solution)
  • Set up Azure Pipeline so it will have Access Engine in there...somehow

My questions are:

  1. Is it possible to execute tests that require MS Access Engine in Azure Pipelines?
  2. If yes, what's the easiest/correct way to do it?


Solution 1:[1]

The effective way is to install Microsoft Access Database Engine on your local machine or VM, and then you can create a self-hosted agent to run your test that require MS Access Engine.

In azure pipeline, it supports running build on microsoft-hosted agent and self-hosted agent.

Check this doc about the Microsoft-hosted agent configuration.

Access Engine is not pre-installed in the microsoft-hosted agent, so the microsoft-hosted agent couldn't meet the test requirements. It may cause the error.

In this situation, the correct method is that you could create a self-hosted agent and run the test on it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kevin Lu-MSFT