Close #24508: Backport the 3.5 MSBuild project files.

The old project files move to PC/VS9.0 and remain supported.

VS2008 is still required to build 2.7; VS2010 (or later, plus Windows SDK 7.1)
is *also* required to use the new project files.
diff --git a/Lib/distutils/command/build_ext.py b/Lib/distutils/command/build_ext.py
index 2ab73aa..3a49454 100644
--- a/Lib/distutils/command/build_ext.py
+++ b/Lib/distutils/command/build_ext.py
@@ -199,10 +199,12 @@
                 else:
                     # win-amd64 or win-ia64
                     suffix = self.plat_name[4:]
-                new_lib = os.path.join(sys.exec_prefix, 'PCbuild')
-                if suffix:
-                    new_lib = os.path.join(new_lib, suffix)
-                self.library_dirs.append(new_lib)
+                # We could have been built in one of two places; add both
+                for d in ('PCbuild',), ('PC', 'VS9.0'):
+                    new_lib = os.path.join(sys.exec_prefix, *d)
+                    if suffix:
+                        new_lib = os.path.join(new_lib, suffix)
+                    self.library_dirs.append(new_lib)
 
             elif MSVC_VERSION == 8:
                 self.library_dirs.append(os.path.join(sys.exec_prefix,
diff --git a/Lib/lib-tk/FixTk.py b/Lib/lib-tk/FixTk.py
index 953dcd5..8af27b5 100644
--- a/Lib/lib-tk/FixTk.py
+++ b/Lib/lib-tk/FixTk.py
@@ -49,7 +49,10 @@
 prefix = os.path.join(sys.prefix,"tcl")
 if not os.path.exists(prefix):
     # devdir/externals/tcltk/lib
-    prefix = os.path.join(sys.prefix, "externals", "tcltk", "lib")
+    tcltk = 'tcltk'
+    if sys.maxsize > 2**31 - 1:
+        tcltk = 'tcltk64'
+    prefix = os.path.join(sys.prefix, "externals", tcltk, "lib")
     prefix = os.path.abspath(prefix)
 # if this does not exist, no further search is needed
 if os.path.exists(prefix):
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index c590331..2458a3d 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -203,6 +203,15 @@
         newsoft = min(hard, max(soft, 1024*2048))
         resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard))
 
+# Windows, Tkinter, and resetting the environment after each test don't
+# mix well.  To alleviate test failures due to Tcl/Tk not being able to
+# find its library, get the necessary environment massage done once early.
+if sys.platform == 'win32':
+    try:
+        import FixTk
+    except Exception:
+        pass
+
 # Test result constants.
 PASSED = 1
 FAILED = 0
diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py
index 9c9afde..4c2e8d5 100644
--- a/Lib/test/test_tcl.py
+++ b/Lib/test/test_tcl.py
@@ -8,9 +8,7 @@
 # Skip this test if the _tkinter module wasn't built.
 _tkinter = test_support.import_module('_tkinter')
 
-# Make sure tkinter._fix runs to set up the environment
-tkinter = test_support.import_fresh_module('Tkinter')
-
+import Tkinter as tkinter
 from Tkinter import Tcl
 from _tkinter import TclError