Microsoft details its strategy for compiling Windows Phone apps in the cloud

Microsoft has taken the wraps off its cloud-compilation architecture for Windows Phone. Here's how it works.
Written by Mary Jo Foley, Senior Contributing Editor

One of the new development concepts introduced with Windows Phone 8 is compiling applications in the cloud. But what does this mean, exactly? 


Among the hundred-plus developer sessions that Microsoft execs presented at the company's Build 2012 conference (and which are now viewable for free by anyone, not just conference-goers) was one touching on Microsoft's cloud-compilation strategy.

The Softies first mentioned intentions to provide compilation in the cloud in June 2012 -- when Microsoft first opened up about some of the features coming in Windows Phone 8. Details were scarce, other than the fact that Microsoft, and not individual developers, was expected to be the one doing the compiling of apps once they were submitted for approval. Up until last week, Microsoft officials declined to say anything further about how cloud-compilation would work for Windows Phone.

(One thing we did know is that cloud compilation is/was part of Microsoft's strategy to insure that existing Windows Phone 7.x apps work well on Windows Phone 8.)

There's now more publicly available information. In addition to the aforementioned Build session, a new Microsoft Channel 9 "Going Deep" episode digs even further into cloud compilation, which Microsoft is advertising as enabling "really fast startup of Windows Phone 8 .Net apps."

The way this works behind the scenes isn't via NGEN (Native Image Generator) reimagined. (Ugh. Did I really just use the "R" word?)

NGEN is a tool for improving performance of managed applications byusing native images stored in cache rather than a just-in-time compiler. Instead, according to the Going Deep presentation, Machine Dependent Intermediate Language (MDIL) is at the core of Microsoft's compiler-in-the-cloud solution. Microsoft officials are claiming that the linking step on devices that convert MDIL assembly to a native image takes one-fifth of the time as traditional NGEN on device.

"Thus, we get some of the benefits of both pre-compilation (since we are executing off the native image where all instructions are assembly instructions) and JIT-compilation (no heavy compilation on the device during framework updates)," the Channel 9 session abstract says.

Here's how Microsoft is describing the process to Windows Phone developers:

"When you build your app in Visual Studio, the code is not compiled into a native image, but into a machine-independent Common Intermediate Language (CIL) binary file. (CIL was formerly known as Microsoft Intermediate Language, or MSIL.) This CIL file is what you submit to the Store when you’re ready to sell your app. At that time, the binary file is converted from CIL to optimized Machine Dependent Intermediate Language, or MDIL. Finally, when the user downloads your app to a device, the MDIL file is linked to produce a native image. These steps are repeated in your development environment whenever you deploy your app to a Windows Phone 8 device.

"The functionality of your app is not affected by the conversion to native code. However, the native image typically starts and runs faster."

If you want to know more about MDIL, you might want to check out Microsoft's patent application for the technology. The inventor is listed as Peter Sollich (who appears in the Going Deep talk about cloud compilation). (Thanks to Charon at Ma-Config.com for digging up the patent.)

I'm curious if Microsoft will make use of this cloud-compilation on the back end on the Windows 8/Windows RT side of the house. If I hear more on that, I will add any comments to this post.

Meanwhile, any Windows Phone app developers out there noticed any performance differences or other tidbits as a result of this new cloud-compilation capability?

Editorial standards