Visual Studio 2015 link 针对 MFC42

Visual Studio 2015 link against MFC42

我最近继续了一个我曾经用 Visual Studio 6 使用 MFC 开发的项目。
我至少 4 年没有接触代码了。
它在 VS6 上编译得很好。
但是现在我安装了 VS2015,转换了项目并修复了一些不再在 VS2015 上编译的代码。
所以一切都很顺利。但是当我尝试在干净的 Windows 10 系统上启动 exe 时,它​​说缺少运行时 dll(例如 MFC140u.dll) 我知道我可以安装 VC++ distributable 来让我的应用程序正常工作,但我的应用程序的大小只有 325kB。 但是我可以看到 MFC42u.dll 在这个空白的 Win 10 系统上。所以已经有一个包含 MFC 的 VC++ 运行时。 我只是不想在每个系统上安装新的 VC++ 运行时,为什么不使用现有的呢?

谁能告诉我在使用 VS2015 时如何 link 针对 MFC42?
提前致谢。

如果您不想打包 vc 可再发行组件,请在安装期间从 Microsoft 下载它们!

InnoSetup script with InnoSetup Dependency Installer 中看起来像

[Languages]
Name: "en"; MessagesFile: "compiler:Default.isl"
Name: "de"; MessagesFile: "compiler:Languages\German.isl"

[Code]
// shared code for installing the products
#include "scripts\products.iss"
// helper functions
#include "scripts\products\stringversion.iss"
#include "scripts\products\winversion.iss"
#include "scripts\products\fileversion.iss"
// actual products       
#include "scripts\products\msiproduct.iss"
#include "scripts\products\vcredist2015.iss"

// Perform some initializations.  Return False to abort setup
function InitializeSetup: Boolean;
begin
  initwinversion();
  SetForceX86(true); // force 32-bit install of next products
  vcredist2015();
  SetForceX86(false); // disable forced 32-bit install again
end;

鉴于您的应用从 VS6 升级后仍然只有 32 位。

想知道为什么这个问题被否决了。
但答案是:不可能。