diff --git a/build/make/gen_msvs_vcxproj.sh b/build/make/gen_msvs_vcxproj.sh
index 4558aa1c175dfa38f8b27debce05d2fdc808c7b0..7c8871ba2083a4e6662a993d16a3bc2ceb5275cb 100755
--- a/build/make/gen_msvs_vcxproj.sh
+++ b/build/make/gen_msvs_vcxproj.sh
@@ -28,6 +28,7 @@ Options:
     --lib                       Generate a project for creating a static library
     --dll                       Generate a project for creating a dll
     --static-crt                Use the static C runtime (/MT)
+    --enable-werror             Treat warnings as errors (/WX)
     --target=isa-os-cc          Target specifier (required)
     --out=filename              Write output to a file [stdout]
     --name=project_name         Name of the project (required)
@@ -233,6 +234,8 @@ for opt in "$@"; do
         ;;
         --static-crt) use_static_runtime=true
         ;;
+        --enable-werror) werror=true
+        ;;
         --ver=*)
             vs_ver="$optval"
             case "$optval" in
@@ -492,7 +495,9 @@ generate_vcxproj() {
             tag_content PreprocessorDefinitions "WIN32;$debug;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE$extradefines;%(PreprocessorDefinitions)"
             tag_content RuntimeLibrary $runtime
             tag_content WarningLevel Level3
-            # DebugInformationFormat
+            if ${werror:-false}; then
+                tag_content TreatWarningAsError true
+            fi
             close_tag ClCompile
             case "$proj_kind" in
             exe)
diff --git a/configure b/configure
index d2f17b048ddef2f446ddf912b853abafe6878cea..170bd8dff668dbfc64d10a0880345ea620b05189 100755
--- a/configure
+++ b/configure
@@ -689,6 +689,7 @@ process_toolchain() {
              10|11|12)
                  VCPROJ_SFX=vcxproj
                  gen_vcproj_cmd=${source_path}/build/make/gen_msvs_vcxproj.sh
+                 enabled werror && gen_vcproj_cmd="${gen_vcproj_cmd} --enable-werror"
                  ;;
              esac
              all_targets="${all_targets} solution"