diff --git a/cpp/.runsettings b/cpp/.runsettings
new file mode 100644
index 00000000..5f3b0228
--- /dev/null
+++ b/cpp/.runsettings
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+ coverage
+ Cobertura
+
+
+
+ .*\.dll$
+
+
+ .*googletestadapter\.(common|core|testadapter)\.dll
+
+
+
+
+
+ ^rust::cxxbridge1::.*
+
+
+
+
+
+
+ True
+
+ True
+
+ True
+
+ False
+
+ True
+
+ True
+
+ True
+
+
+
+
+
+
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 6856149b..acda478a 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -253,6 +253,12 @@ if(MSVC)
"/sdl"
"$<$:/RTC1>")
target_link_options(libloot PRIVATE "/INCREMENTAL:NO" "/LTCG")
+
+ # Copy test code coverage config into build directory where MSVC expects to
+ # find it.
+ configure_file("${PROJECT_SOURCE_DIR}/.runsettings"
+ "${PROJECT_BINARY_DIR}/.runsettings"
+ COPYONLY)
endif()
##############################