visual studio – C++ MSB8041 Error: MFC libraries are required for this project


I installed every available MFC option, which is not out of support, restarted Visual Studio 2022, and I still get this error.

MFC libraries are required for this project. Install them from the Visual Studio installer (Individual Components tab) for any toolsets and architectures being used.

I initially had the default ISO C++ 14 Standard, but tried switching to the ISO C++ 17 Standard, but that yielded the exact same error. I have v143 as the target platform toolset. Here are the settings:

VS2022 C++ Version Settings

Although you cannot see the entire list, I did select and install all available MFC options, and definitely for the v143 option, as you can see.

InstalledVS2022 MFC Options

Also, how can I tell exactly which C++vXX.XX that it wants?

Last Part of VS2022 Installed MFC Options

Here is the offending line:

   <VCMessage Code="MSB8041" Type="Error" Arguments="MFC" Condition="'$(CheckMFCInstalled)' == 'true' and !Exists($(MFC_KeyFile)) and '$(SpectreLibs)' == ''" />

That means Spectre is not used. That leaves the value of $(MFC_KeyFile) and $(CheckMFCInstalled). A VS does terminal does not help me, as I cannot just do ? $(MFC_KeyFile). A terminal window is not a debugger.

Thoughts?

Leave a Reply

Your email address will not be published. Required fields are marked *