Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2012 Error C1107

I am getting the following error:

fatal error C1107: could not find assembly 'platform.winmd': please specify the assembly search path using /AI or by setting the LIBPATH environment variable

Steps to reproduce

0) Create a new empty project

1) C/C++ > General > Consume Windows Runtime Extension > YES

2) C/C++ > Code Generation > Enable Minimal Rebuild > No

3) Add a source file *.cpp, file can be blank

4) Attempt to compile

I tried to manually compare and change the project settings to match that in some sample code but nothing seems to work.

like image 735
aCuria Avatar asked Feb 25 '13 14:02

aCuria


2 Answers

I don't understand what the problem you have, so

  1. If you don't want to code against WinRT just set "Consume..." to false and the issue will be gone
  2. If you want to code against WinRT you should perform an additional step: go to General and set Windows Store App Support to true
like image 90
ixSci Avatar answered Nov 15 '22 12:11

ixSci


To create a C++/CX Desktop application:

In C/C++ -> General project properties, set Consume Windows Runtime Extension to Yes

In the same tab enter these to your Additional #using Directories enter the directories containing the windows.winmd and platform.winmd files. For me, with VS2017, that is:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\lib\store\references;
C:\Program Files (x86)\Windows Kits\10\UnionMetadata;
C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\2.0.0.0;
C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.FoundationContract\2.0.0.0

Then call RoInitialize or use a WinRT main style function (to remove the warning C4447 about main threading):

using namespace Platform;

int main(Array<String^>^ args) ....

References:
Using C++/CX in Desktop apps,
Calling Windows 10 APIs from a desktop application

like image 25
noelicus Avatar answered Nov 15 '22 13:11

noelicus