The Key to Cross-Platform Coding is .NET Everywhere

No longer a pipe dream, cross-platform coding has been made fairly straightforward and nearly ordinary with tools from Xamarin and others. At VSLive!, Microsoft's James Montemagno demonstrated the ease with which cross-platform apps can be delivered without venturing too far from the C# space.

By Lafe Low

03/16/2017

Being able to write code and run it anywhere is no longer just a dream. With cross-platform technologies like Xamarin, it's easily within reach. James Montemagno, principal program manager for Xamarin at Microsoft, gave a demo-heavy keynote presentation entitled ".NET Everywhere." He showed the crowd how straightforward it can be to develop once and deploy to multiple platforms. Montemagno's presentation was Wednesday, March 15 at Visual Studio Live! in Las Vegas.

Montemagno came to Microsoft through its acquisition of Xamarin. "My real focus is Xamarin. I've been living and breathing it for the last six years," he said. "You can take C# and .NET code and run it everywhere, and I want to show you how to do that." And with that he launched into an extensive series of demos.

"I love C#," he said. "It's simply the best programming language ever created." When he first went to Xamarin, he had a similar reaction. "I downloaded Xamarin and fell in love immediately." His affections for these technologies are due to the time-saving ability to share code.

"You can create beautiful native apps," he said. "You want to share code? With Xamarin, you can share 70-80 percent of your business logic. Xamarin embraces and extends .NET. Xamarin delivers every single API and all your .NET stack and libraries, so I'm building native user interfaces and access to all APIs for native performance."

He began the demo portion working within Visual Studio, with Xamarin installed. "I'm going to build a brand new iPhone app. It looks like a .NET project, with all the properties and references. It all makes sense as a .NET developer. This is a Xamarin native app, so I have a main storyboard for an overview of the app."

He worked through the process of creating this single view geolocator app. "I am going to create a storyboard layout," he says. "You could think of this as a drag and drop user interface."

As he finished up the first demo, he summarized what he had just accomplished. "So I just dropped a few controls and wrote 15 lines of C# code to do all that," he said. "And that was all in Visual Studio. I never left my development environment."

He reiterated the cross-platform possibilities of the new technologies. "When I say C# everywhere, I mean C# everywhere," he said. "With .NET core, you could take your .NET code anywhere, whether it's to the web, to a server, to Linux, it doesn't matter. You can put .NET code absolutely everywhere."

He enthusiastically put this statement in context with a bit of history. "A little more than year ago, Xamarin joined Microsoft. That was an awesome day, I knew we were going to do awesome things together," he said. "In the last year, we've worked tightly with .NET team, the ASP.NET team and all the other amazing teams building libraries at Microsoft. Now we have this amazing IDE call Xamarin on the Mac. We also now have Visual Studio for the Mac, and they're all free Community editions."

The open source movement at Microsoft has also been part of this story. "We've worked hard to open source all the Xamarin integrations like Xamarin Android and Xamarin iOS. We've open sourced our .NET runtime called Mono. We've also open sourced Xamarin forms. And created .NET standard for unification of .NET across all platforms. What this means is that as a .NET developer is you just write code and it just works everywhere," said Montemango. "It's a dream we've all wanted for a long time."

Montemagno wrapped up by sharing some educational resources. "As a developer, all this is moving fast," he said. ".NET is moving fast, C# is moving fast, and Xamarin is a brand new platform to target. How do you learn all this?" The series of interactive workbooks available on Xamarin University is one way to quickly get up to speed on this new cross-platform world.

The next Visual Studio Live! event happens in Austin, TX in May 15-18. Click here for more information.

About the Author

Lafe Low has been a technology editor and writer for more than 25 years. Most recently, he was the editor in chief of TechNet magazine. He has also held various editorial positions with Redmond magazine, CIO magazine and InfoWorld. He also launched his own magazine entitled Explore New England, and has published four editions of his guidebook The Best in Tent Camping: New England.