How to exclude play mode tests from client builds

We are using Unity 2018.4, and we have a few play mode tests in our project.
I would like them to be excluded from the builds we are releasing to the mobile app stores.

Using .asmdef (Assembly definition files) i saw there’s an option to mark the assembly as a “test assembly”:

Unfortunately, this does not work, since some of our tests reference a .DLL that is included in the project (getting a compiler error).

What are the options for solving this? assembly definitions cannot reference DLLs, only other assembly definitions. Is the only option to define other .asmdefs and link them to my test assembly ?

“Override References”

1 Like

When using assembly definition files for my tests, why doesn’t it automatically reference the “rest of the codebase” ? (e.g: the built-in assemblies such as Assembly-CSharp) ?

Moving the tests to their own .asmdef means i now have to compile the rest of the project in this way.