building with Visual Studio 2019 but getting depend on MFC140U.dll

Viewed 2567

I have moved from VS2015 to VS2019. I've created a deployment and all is good locally, here on three machines. But when I shipped a test MSI out to an old laptop we got an MFC140.dll not found. I found the dependency in one of my dlls, thought it had something to do with not moving it up to UNICODE. Did that and it still depends on MFC140U.dll

I do have

toolset       (VS 2019)vs142
SDK Version   10.0(latest installed)

I've googled and pulled hair out. But the lights are not coming on. Checked, and this is also happening to a second dll I build.

So I check another app that goes into the deployment. It does not use any of my dlls. Yet it also depends on MFC140U.dll as well as MFC142U.dll. The only libs linked in this one are BOOST and SQLITE3. And those don't have any MFC dependencies. This just adds to my confusion.

The only thing that would make sense to me is that a vs142 build has some 140 dependency and the deployment system is not picking that up. Note that deployment is not done with install shield as was done with vs2015.

Yes, I could fix it by shipping the MFC140U.dll but that just does not seem right. Either I, or Microsoft, has something wrong is all I can figure.

UPDATE:

I created a fresh MFC project with VS2019 and looked at the depends. Same thing, this is about Microsoft. And it looks like the deployment system includes MFC142x dlls but not the MFC140 that is required.

1 Answers

You don't mention what your "deployment system" is, so I'm not sure what installer technology you are using here.

But your application or one of your DLL's has a dependency on MFC. If MFC isn't needed, you'll want to check your build settings on the exe or dll in question. The other item to check is if you are errantly including the afx.h header in your project. The afx.h has #pragma comment(lib, xxx) entries that resolve to the proper mfc140xxx.lib depending on your build options.

If the MFC dependency is legitimate, you should be installing the VC runtime components using the vsredist packages designed for just that purpose. These should be installed to your hard drive under a path similar to C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.21.27702

Alternatively, you can download the latest using the following link:

The latest supported Visual C++ downloads

Sincerely,

Related