且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 Windows 8 应用商店应用程序(使用 Visual C++ 2012 构建)中使用 C++ 库(使用 Visual C++ 2010 构建)

更新时间:2022-03-18 01:18:00

您不能在 Windows 8 应用商店应用中使用使用旧版 Visual Studio(早于 Visual Studio 2012)构建的 C++ 二进制文件.

You cannot use C++ binaries built using older version of Visual Studio (older than Visual Studio 2012) in your Windows 8 Store apps.

这样做的原因是因为使用 Visual Studio 2010 构建的二进制文件将依赖于来自 Visual Studio 2010 的 C++ 运行时 DLL.而您的应用程序的其余部分是使用 Visual Studio 2012 编写的,因此它将依赖于Visual Studio 2012 中的 C++ 运行时 DLL.后者可从 Windows 应用商店自动获取(阅读 this 了解更多详情).但是,前者在 Windows 应用商店中不可用.此外,您的应用程序无法表达对 VC2010 运行时的依赖.在应用包中包含 VC2010 运行时 DLL 也将不起作用,因为该包将在商店上传时被拒绝.

The reason for that is because a binary built using say Visual Studio 2010 will have a dependency on the C++ Runtime DLLs from Visual Studio 2010. Whereas the rest of your app is written using Visual Studio 2012 so it will have a dependency on C++ Runtime DLLs from Visual Studio 2012. The latter is made automatically available from the Windows Store (read this for more details). However the former is not available on the Windows Store. Also, there is no way for your app to express a dependency on VC2010 Runtime. Including VC2010 Runtime DLLs inside the app package will also not work since the package will be rejected at Store upload time.

因此,***的选择是严格使用 Visual Studio 2012 为您的 Windows 8 应用商店应用构建所有源.

Therefore the best option is to build all sources for your Windows 8 Store app strictly using Visual Studio 2012.