diff --git a/openrct2.common.props b/openrct2.common.props
index 72eb374c7c..64d144e987 100644
--- a/openrct2.common.props
+++ b/openrct2.common.props
@@ -74,6 +74,16 @@
true
+
+
+ __TEST__;%(PreprocessorDefinitions)
+
+
+
+
+ NDEBUG;__TEST__;%(PreprocessorDefinitions)
+
+
diff --git a/src/core/Guard.cpp b/src/core/Guard.cpp
index 2b6518aa39..479f976104 100644
--- a/src/core/Guard.cpp
+++ b/src/core/Guard.cpp
@@ -78,7 +78,9 @@ namespace Guard
char *bufend = (char *)strchr(buffer, 0);
vsnprintf(bufend, sizeof(buffer) - (bufend - buffer), message, args);
}
- int result = MessageBox(nullptr, buffer, OPENRCT2_NAME, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION);
+ // Only show message box if we are not building for testing
+#ifndef __TEST__
+ int result = MessageBoxA(nullptr, buffer, OPENRCT2_NAME, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION);
if (result == IDABORT)
{
#ifdef USE_BREAKPAD
@@ -88,6 +90,7 @@ namespace Guard
assert(false);
#endif
}
+#endif
#else
assert(false);
#endif