diff --git a/Misc/NEWS b/Misc/NEWS
index 5e2836abd57..1eb37eafbbc 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -447,6 +447,8 @@ Tools/Demos
Windows
-------
+- Issue #28065: Update xz dependency to 5.2.2 and build it from source.
+
- Issue #25144: Ensures TargetDir is set before continuing with custom
install.
diff --git a/PCbuild/_lzma.vcxproj b/PCbuild/_lzma.vcxproj
index 1f0696da82e..7ec26920107 100644
--- a/PCbuild/_lzma.vcxproj
+++ b/PCbuild/_lzma.vcxproj
@@ -61,13 +61,11 @@
- $(lzmaDir)include;%(AdditionalIncludeDirectories)
+ $(lzmaDir)src/liblzma/api;%(AdditionalIncludeDirectories)
WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;LZMA_API_STATIC;%(PreprocessorDefinitions)
- $(lzmaDir)\bin_i486\liblzma.a;%(AdditionalDependencies)
- $(lzmaDir)\bin_x86-64\liblzma.a;%(AdditionalDependencies)
- false
+ $(OutDir)/liblzma$(PyDebugExt).lib
@@ -81,8 +79,12 @@
{cf7ac3d1-e2df-41d2-bea6-1e2556cdea26}
false
+
+ {12728250-16eC-4dc6-94d7-e21dd88947f8}
+ false
+
-
\ No newline at end of file
+
diff --git a/PCbuild/get_externals.bat b/PCbuild/get_externals.bat
index a45e73d4bbc..91a2a6dca69 100644
--- a/PCbuild/get_externals.bat
+++ b/PCbuild/get_externals.bat
@@ -59,7 +59,7 @@ set libraries=%libraries% sqlite-3.14.1.0
if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tcl-core-8.6.6.0
if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tk-8.6.6.0
if NOT "%IncludeTkinter%"=="false" set libraries=%libraries% tix-8.4.3.6
-set libraries=%libraries% xz-5.0.5
+set libraries=%libraries% xz-5.2.2
for %%e in (%libraries%) do (
if exist %%e (
diff --git a/PCbuild/liblzma.vcxproj b/PCbuild/liblzma.vcxproj
new file mode 100644
index 00000000000..711f9bd64ff
--- /dev/null
+++ b/PCbuild/liblzma.vcxproj
@@ -0,0 +1,216 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ PGInstrument
+ Win32
+
+
+ PGInstrument
+ x64
+
+
+ PGUpdate
+ Win32
+
+
+ PGUpdate
+ x64
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ {12728250-16EC-4DC6-94D7-E21DD88947F8}
+ liblzma
+ true
+
+
+
+
+
+
+ StaticLibrary
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>10.0.30319.1
+
+
+
+ WIN32;HAVE_CONFIG_H;_DEBUG;_LIB;%(PreprocessorDefinitions)
+ Level3
+ ProgramDatabase
+ Disabled
+ $(lzmaDir)windows;$(lzmaDir)src/liblzma/common;$(lzmaDir)src/common;$(lzmaDir)src/liblzma/api;$(lzmaDir)src/liblzma/check;$(lzmaDir)src/liblzma/delta;$(lzmaDir)src/liblzma/lz;$(lzmaDir)src/liblzma/lzma;$(lzmaDir)src/liblzma/rangecoder;$(lzmaDir)src/liblzma/simple
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PCbuild/python.props b/PCbuild/python.props
index 5f5e756669a..015009864b3 100644
--- a/PCbuild/python.props
+++ b/PCbuild/python.props
@@ -45,7 +45,7 @@
$([System.IO.Path]::GetFullPath(`$(PySourcePath)externals\`))
$(ExternalsDir)sqlite-3.14.1.0\
$(ExternalsDir)bzip2-1.0.6\
- $(ExternalsDir)xz-5.0.5\
+ $(ExternalsDir)xz-5.2.2\
$(ExternalsDir)openssl-1.0.2h\
$(opensslDir)include32
$(opensslDir)include64