diff --git a/Misc/NEWS.d/next/Build/2018-05-28-11-40-22.bpo-33614.28e0sE.rst b/Misc/NEWS.d/next/Build/2018-05-28-11-40-22.bpo-33614.28e0sE.rst
new file mode 100644
index 00000000000..9091c282ad0
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2018-05-28-11-40-22.bpo-33614.28e0sE.rst
@@ -0,0 +1,2 @@
+Ensures module definition files for the stable ABI on Windows are correctly
+regenerated.
diff --git a/PCbuild/find_msbuild.bat b/PCbuild/find_msbuild.bat
index 2b7413fbcde..1364a17432e 100644
--- a/PCbuild/find_msbuild.bat
+++ b/PCbuild/find_msbuild.bat
@@ -48,5 +48,13 @@
@exit /b 1
:found
-@echo Using %MSBUILD% (found in the %_Py_MSBuild_Source%)
+@pushd %MSBUILD% >nul 2>nul
+@if not ERRORLEVEL 1 @(
+ @if exist msbuild.exe @(set MSBUILD="%CD%\msbuild.exe") else @(set MSBUILD=)
+ @popd
+)
+
+@if defined MSBUILD @echo Using %MSBUILD% (found in the %_Py_MSBuild_Source%)
+@if not defined MSBUILD @echo Failed to find MSBuild
@set _Py_MSBuild_Source=
+@if not defined MSBUILD @exit /b 1
diff --git a/PCbuild/python3dll.vcxproj b/PCbuild/python3dll.vcxproj
index c66c8ef141a..0ef7780248f 100644
--- a/PCbuild/python3dll.vcxproj
+++ b/PCbuild/python3dll.vcxproj
@@ -89,14 +89,18 @@
-
+
<_DefLines Remove="@(_DefLines)" />
<_Lines Remove="@(_Lines)" />
+ <_OriginalLines Remove="@(_OriginalLines)" />
+
+
+
<_Pattern1>(=python$(MajorVersionNumber)$(MinorVersionNumber))\.
<_Sub1>$1_d.
@@ -109,17 +113,23 @@
-
+
+
-
+
<_DefLines Remove="@(_DefLines)" />
<_Lines Remove="@(_Lines)" />
+ <_OriginalLines Remove="@(_OriginalLines)" />
+
+
+
<_Pattern>^[\w.]+=.+?\.([^ ]+).*$
<_Sub>$1
@@ -132,6 +142,8 @@
<_Lines Include="@(_Symbols->'%(Symbol)')" />
-
+
+
\ No newline at end of file