Windows RT and c#

匆匆过客 提交于 2019-11-28 23:53:53

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.

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!