RuntimeError: MFC redist DLLs not found like (looking for mfc140u.dll)
andreabravetti opened this issue · comments
Expected behavior and actual behavior
It should find mfc140u.dll in the correct path but it fail with:
RuntimeError: MFC redist DLLs not found like ['C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\redist\x64\MFC\mfc140u.dll', 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Redist\MSVC\14.39.33519\x64\\mfc140u.dll']!
Steps to reproduce the problem
Install Build Tools with Microsoft.VisualStudio.Component.VC.ATLMFC:
I used:
vs_buildtools.exe --quiet --wait --norestart --nocache \
--add Microsoft.VisualStudio.Workload.VCTools \
--add Microsoft.VisualStudio.Component.VC.CoreBuildTools \
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
--add Microsoft.VisualStudio.Component.VC.Redist.14.Latest \
--add Microsoft.VisualStudio.Component.VC.CMake.Project \
--add Microsoft.VisualStudio.Component.VC.ATLMFC \
--add Microsoft.VisualStudio.Component.TestTools.BuildTools \
--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 \
--add Microsoft.VisualStudio.Component.Windows10SDK \
--add Microsoft.VisualStudio.Component.Windows11SDK.22621
The redist is installed but it is in 14.38.33135 and not 14.39.33519.
Everything is installed with the latest vs_buildtools_2022.exe as of today.
Tools are in:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519
Redists are in:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Redist\MSVC\14.38.33135
It seems it take the version from the Tools to build the path for the Redist but no packages provides this version of the redist, at least as I know.
If I remove Microsoft.VisualStudio.Component.VC.ATLMFC the build is successful, but I need it for other things.
I use to build pywin32 with:
call C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Auxiliary/Build/vcvars64.bat
python.exe setup.py -q build
python.exe setup.py -q --skip-verstamp install
System information
Python version and distribution: 3.11.9 built on the same system
pywin32 version: 306 (tags/b306.tar.gz)
Windows Version: mcr.microsoft.com/windows/servercore:ltsc2022 (docker)
I have a fix here:
It works in my case but I will wait for some feedback before making a pull request.
Also I'm starting thinking that in the case you have a lot of redist installed it may be better to get the last version with at least the same major version from vcverdir (in this case 14.* instead of *....)
this fix works for me. In my case the redist version was behind my VC version and was unable to be found