问题
I need to develop Metro style application using C# and XAML which has to work on Windows RT devices and full Windows 8 OS. So I'm allowed to use only WinRT without any .net framework assemblies. I've read this question
Microsoft Surface Tablet: Writing Apps for Both Devices?
and this very usefull post: http://blogs.msdn.com/b/jasonz/archive/2012/06/12/what-you-need-to-know-about-developing-for-windows-on-arm-woa.aspx, but i stil have question: When i even create a Blank Metro Style Application project I have .NET asseblies for metro style. Do I have remove them by myself or i do something wrong? And what i should do if need to use something like Prism fw ported to WinRT or mvvvm light? Are they allow me to develop application for WOA only on native WinRT? These moments are not clear for me.
Can you explain my what the difference between Windows RT and Windows on ARM Do i need to use only WinRT (without .net) to develop for WindowsRT OS?
Hope you can help me.
回答1:
Let me answer you in the most direct way I can. If you open a Blank XAML/C# Windows Store project. That project will run on Windows RT (ARM) and Windows 8 (x86/x64). That's because it is built to accomplish this. Just because you have what feels like the .Net Framework, don't worry - you are writing a cross-platform application.
Now, for the caveats. You made this answer easy because of C#. CPP developers don't have the same guarantee because there are coding things they can do to break this compatibility. Not so in C#. If the code you write compiles to "Any CPU" then what I am saying is correct.
If you introduce something (like the Bing Maps control) that requires your build to change from "Any CPU" to something else. The Windows Store will let you submit three versions of your app under the same name - one for each platform - and the user will never know there is more than one.
In that last example, you are still supporting every platform, you just have to specific three different builds to accomplish it – your code may not change at all! In most scenarios, you support them all out of the gate. If you introduce a third party library - like MVVMlite - you are still okay if you can build to any CPU. Most libraries are cool like that.
回答2:
It's not quite correct to say you can't use the .net framework in Metro style apps. More correctly, there is a version of the .net framework which is only available for metro apps. If your assemblies were not built with this version of the .net framework they will not work for metro. This version of the .net framework will work on .86 and arm. There is also a version of MVVM Light for metro apps. Download it here. See here for details on developing for arm.
Regardless of whether you’re using JavaScript, C++, Visual Basic, or C#, if you’ve built a Metro style app that targets x86/x64 then you already know how to build one that targets ARM. You use the same Metro style project templates, which provide the starting point for building an app.
Edit: As Jerry points out, you may have to compile your application against different versions of libraries if they are written in C++, but that's a matter of having separate builds rather than having to do additional development.
回答3:
If you make your libraries portable class libraries, you can use them for desktop, metro, and phone apps (and xbox too). You can choose this when you start a library, or in the project's properties. It makes it easier to write cross platform apps within the mircrosoft ecosystem.
来源:https://stackoverflow.com/questions/12631363/windows-rt-and-c-sharp