Run the specified NUnit test as a 32-bit process in a 64-bit environment

I have a component that uses OLEDB to import data from an Excel file. Due to business risks and time constraints, my executable shell compiles as x86 (32-bit) to avoid the 64-bit OLEDB task , and the component works flawlessly when loaded into my 32-bit shell.

However, my CI build process (TeamCity) launches its TestRunner in a 64-bit process, and therefore unit tests aimed at the above functions fail with the usual error message:

Test failed. System.InvalidOperationException: The Microsoft.Jet.OLEDB.4.0 provider is not registered on the local computer. car

My decisions look like

  • Change the CI test leader - this is not possible because testrunner is used by 10 other commands.
  • Verify that this test runs in a 32-bit process.

So, is there a way to tell NUnit or the TeamCity NUnit tester to run a specific test in a 32-bit process? Ideally, I would like the same tests to run unchanged in the IDE and CI.

+4
source share
1 answer

Changing the "platform target" to x86 in the unit test project should do the trick.

+4
source

All Articles