locked
Can't i select Any CPU while compiling WinRT Components?

    Question

  • How can i enable "Any CPU" selection for my dll + winmd file so i can use it with my "Any CPU" c# solution?

    It is not listed in the dropdown box.


    Tuesday, April 17, 2012 2:17 PM

Answers

  • @ELRaymond

    I assume you mean creating a *native* component and you want it to be AnyCPU.  No, you cannot do this as there is no notion of that in native.  If you are creating a WinRT component starting from C++ then it will be architecture-specific.  And then your managed app consuming it would also have to be.

    You can, however, create a managed WinRT component and have that be AnyCPU.  Of course anyone using this from C++ would them be bringing in the CLR broker host process.


    Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)

    Friday, June 08, 2012 2:47 PM
  • I believe SQLite is a native component and so will be architecture-specific. That will force your component containing it to also be architecture-specific.

    AnyCPU only works if the component is purely managed code.

    --Rob

    Friday, June 08, 2012 3:35 PM
    Owner

All replies

  • Hello ELRaymod,

    I managed to successfully config the platform of the WinRT project to be "Any CPU" on my side: right-click the project and select Properties->Build->select the Platform to be "Any CPU" from the dropdown list.

    However, for one thing you need to be aware is that even though the Visual Studio setting dictates “Any CPU” and the Windows version is 64-bit, the actual process is still 32-bit.

    Thanks,


    Vicky Song [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, April 19, 2012 6:49 AM
    Moderator
  • Hi Vicky,

    I got the same problem in the release preview sample of custom driver assess (C#,C++).

    I can't set "Any CPU" platform on the WinRT project. I can't add reference of the winmd to the Any CPU C# metro project.

    Could you help me to find a way to fix this problrm?

    Thanks.

    Friday, June 08, 2012 7:15 AM
  • @ELRaymond

    I assume you mean creating a *native* component and you want it to be AnyCPU.  No, you cannot do this as there is no notion of that in native.  If you are creating a WinRT component starting from C++ then it will be architecture-specific.  And then your managed app consuming it would also have to be.

    You can, however, create a managed WinRT component and have that be AnyCPU.  Of course anyone using this from C++ would them be bringing in the CLR broker host process.


    Tim Heuer | Program Manager, XAML | http://timheuer.com/blog | @timheuer

    (if my post has answered your question, please consider using the 'mark as answer' feature in the forums to help others)

    Friday, June 08, 2012 2:47 PM
  • To be more specific: I am coding everything with C# and i have included SQLite.

    Friday, June 08, 2012 2:57 PM
  • I believe SQLite is a native component and so will be architecture-specific. That will force your component containing it to also be architecture-specific.

    AnyCPU only works if the component is purely managed code.

    --Rob

    Friday, June 08, 2012 3:35 PM
    Owner