none
????? RRS feed

全部回复

  • 你好,

    我想简单问一下,你的dll项目是自己写出来的吗?

    如果是的话,有一个更加简单的方法,使用SDK的机制,让系统自动帮你把内容引用上: 演练:使用 C++ 创建 SDK, 这样就不需要担心平台的不同了。或者把C++项目写成一个Runtime Component,这样就可以顺利的被引用了。

    如果你的代码从其他地方下载的话,我看了下文档,似乎没有明确说明 http://msdn.microsoft.com/en-us/library/windows/apps/hh699881.aspx

    A Windows Runtime component consists of a DLL file and a .winmd file that contains the metadata. Typically, these files are located in the same folder. In the left pane of the Add Reference dialog box, choose the Browse button and then navigate to the location of the DLL and its .winmd file.

    不过你能否尝试把三个都引用上?

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2014年9月25日 6:08
    版主
  • 如果只有winmd文件的话是不够的,dll才是具体实现代码的地方,没有dll的winmd是引用不了的。

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2014年9月25日 10:06
    版主
  • 你好,

    我查了下文档: How to: Add or Remove References By Using the Reference Manager

    貌似真的只能用SDK的方式来做引用。如果是C#生成的组件的话,似乎是不能生成dll的,不过C++的文件我本地测试的确生成了dll:

    You can generate a WinMD file in Visual Studio in two ways:

    • Windows Store app managed projects: Windows Store app projects can output WinMD binaries by setting Project Properties | Output Type = WinMD File. The WinMD filename must be the superset namespace of all the namespaces that exist within it. For example, if a project consists of namespaces A.B and A.B.C, the possible names for its outputted WinMD are A.winmd and A.B.winmd. If a user enters a Project Properties | Assembly Name or Project Properties | Namespace value that’s disjoint from the set of namespaces in the project or there is no superset namespace within a project, a build warning is generated: 'A.winmd' isn’t a valid .winmd file name for this assembly. All types within a Windows Metadata file must exist in a sub namespace of the file name. Types that don’t exist in a sub namespace of the file name won’t be able to be located at runtime. In this assembly, the smallest common namespace is 'CSWSClassLibrary1'. A desktop Visual Basic or Visual C# project can only consume WinMDs that are generated by using the Windows 8 SDKs, which are known as first-party WinMDs, and can’t generate WinMDs.

    • Windows Store app native projects: A native WinMD file consists of only metadata. Its implementation exists in a separate DLL file. One can produce native binaries by choosing the Windows Runtime Component project template in the New Project dialog box or by starting from a blank project and modifying the project properties to generate a WinMD file. If the project consists of disjoint namespaces, a build error will tell the user to combine their namespaces or run the MSMerge tool.

    好像结论还是需要生成一个SDK来使用, Creating a Software Development Kit

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    2014年9月26日 9:43
    版主