Answered by:

Cannot add VS2012 Ultimate Win32 DLL to Windows Store app package

Question

I created a new solution for a Windows Store app (blank, C++/CX). Next, I created a WinRT Runtime component in C++/CX, and added a reference to the app. The app and WinRT runtime component are packaged together and the app
can access the WinRT runtime component fine.

Next, I created a Win32 DLL project in the same solution. The idea is to link the Win32 DLL to the WinRT runtime component via import lib (which I configured via linker input settings, builds fine). Then, in order to get the Win32 DLL packaged,
I tried adding a reference to the Win32 DLL to both the WinRT runtime component and WinRT app projects. It refuses to be copied into my Windows Store app package. In both cases, I tried setting "Copy Local" = "True"
as well as "False". In fact, setting "Copy Local" to "True" reverts back to "False" when I click Apply (wt#..?). Could this be b/c the Win32 is not built with Windows Store App support? That's
not a constraint mentioned in the docs on native DLLs in a C++/CX app, which I followed to the letter.

I see lots of complaints, responses, and workarounds about not being able to add a Win32 DLL, either as a project or standalone binary, to an app package. None of these solutions or workarounds work for me.

My package surely will not pass WACK with the Win32 DLL cuz it contains banned APIs. Does this mean I need to deploy it separately as a desktop install?

You cannot have your Windows Store app use a Win32 DLL that won't pass WACK. There's no way for it to load it at runtime unless it is deployed with your app, and as you've noted you can't deploy it with your app if it won't pass WACK.

A Win2 DLL can be used by a Windows Store apps, but only if it doesn't use
banned APIs. You also cannot load an arbitrary DLL into your app from elsewhere on the system.

There are really only three 'tricks' to using a Win32 DLL with a Windows Store app

(1) It has to be built using VS 2012 using the CRT DLL version of the runtime (i.e. not static linking or an older version of VS)

(2) If you want the DLL to be built as part of your Windows Store app solution, you need to use IMPLICIT rather than EXPLICIT linking. Explicity linking basically only works for a Win32 DLL that has already been built and is added to your Windows Store app as
'content'.

(3) To actually deploy as part of your app, the Win32 DLL must avoid all banned APIs and pass the WACK tool.

You cannot have your Windows Store app use a Win32 DLL that won't pass WACK. There's no way for it to load it at runtime unless it is deployed with your app, and as you've noted you can't deploy it with your app if it won't pass WACK.

A Win2 DLL can be used by a Windows Store apps, but only if it doesn't use
banned APIs. You also cannot load an arbitrary DLL into your app from elsewhere on the system.

There are really only three 'tricks' to using a Win32 DLL with a Windows Store app

(1) It has to be built using VS 2012 using the CRT DLL version of the runtime (i.e. not static linking or an older version of VS)

(2) If you want the DLL to be built as part of your Windows Store app solution, you need to use IMPLICIT rather than EXPLICIT linking. Explicity linking basically only works for a Win32 DLL that has already been built and is added to your Windows Store app as
'content'.

(3) To actually deploy as part of your app, the Win32 DLL must avoid all banned APIs and pass the WACK tool.