Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't load WinRT Component unless I reference the project
    primarykey
    data
    text
    <p>I'm running into an odd problem. I created a Windows Runtime Component (for Windows Store) that makes some legacy C/C++ code available to .NET via some C# wrapper classes.</p> <p>I wrote a test harness Store App (hereafter referred to as "test1") that references the WRC <em>project</em> (both projects in the same solution). It calls into the component and everything works fine.</p> <p>Next I take the following output files from the WRC project:</p> <pre><code>MyWrtComponent.dll MyWrtComponent.exp MyWrtComponent.pdb MyWrtComponent.pri MyWrtComponent.winmd </code></pre> <p>...and try to use them from another Store app project ("test2"). In this project, instead of referencing the MyWrtComponent project, I add a reference to the .winmd file. Everything builds fine, but when I run the test2 app I get a System.IO.FileNotFound exception from mscorlib as soon as I try to use one of the C# classes implemented in MyWrtComponent:</p> <pre><code>at System.StubHelpers.StubHelpers.GetWinRTFactoryObject(IntPtr pCPCMD) at MyWrtComponent.MyWrtClass..ctor() The specified module could not be found. (Exception from HRESULT: 0x8007007E) </code></pre> <p>Using release vs. debug build of the MyWrtComponent doesn't make any difference.</p> <p>Running ProcMon on test2, I see several unsuccessful attempts at loading vccorlib120_app.DLL (or vccorlib120d_app.DLL if I'm building debug):</p> <pre><code>QueryOpen F:\test2\bin\Debug\AppX\vccorlib120d_app.DLL NAME NOT FOUND QueryOpen F:\test2\bin\Debug\AppX\vccorlib120d_app.DLL NAME NOT FOUND CreateFile C:\Windows\SysWOW64\vccorlib120d_app.DLL NAME NOT FOUND </code></pre> <p>I've confirmed that this file doesn't exist in my C:\Windows\SysWOW64 folder. I don't know whether that's relevant to my problem.</p> <p>When I run test1, different locations are searched, and the file is found:</p> <pre><code>QueryOpen F:\test1\bin\Debug\AppX\vccorlib120d_app.DLL NAME NOT FOUND CreateFile C:\Program Files\WindowsApps\Microsoft.VCLibs.120.00.Debug_12.0.20827.3_x86__8wekyb3d8bbwe\vccorlib120d_app.dll SUCCESS </code></pre> <p>I compared the bin\Debug\AppxManifest.xml of both test projects, and noticed one important difference; test1 has the following and test2 doesn't:</p> <pre><code>&lt;Dependencies&gt; &lt;PackageDependency Name="Microsoft.VCLibs.120.00.Debug" MinVersion="12.0.20827.3" /&gt; &lt;/Dependencies&gt; </code></pre> <p>If I add these three lines to the generated output of test2 and run the app, it works, but of course that's not a real fix.</p> <p>Does anyone understand what's going on here? Does MyWrtComponent have a dependency that somehow isn't being communicated, or am I supposed to do something to package vccorlib120d_app.DLL along with my runtime component, or ... ?</p> <p>Thanks in advance. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload