Developing for Multiple Platforms with the .NET Framework

.NET Framework 4.5

You can develop apps for both Microsoft and non-Microsoft platforms by using the .NET Framework and Visual Studio.

To develop for multiple platforms, you can share source code or binaries, and you can make calls between .NET Framework code and Windows Runtime APIs.

If you want to...

Use...

Share source code between Windows Phone 8.1 and Windows 8.1 apps

Shared projects (Universal Apps template in Visual Studio 2013, Update 2).

  • Currently no Visual Basic support.

  • You can separate platform-specific code by using #if statements.

For details, see:

Share binaries between apps that target different platforms

Portable Class Library projects for code that is platform-agnostic.

  • This approach is typically used for code that implements business logic.

  • You can use Visual Basic or C#.

  • API support varies by platform.

  • Portable Class Library projects that target Windows 8.1 and Windows Phone 8.1 support Windows Runtime APIs and XAML. These features aren't available in older versions of the Portable Class Library.

  • If needed, you can abstract out platform-specific code by using interfaces or abstract classes.

For details, see:

Share source code between apps for platforms other than Windows 8.1 and Windows Phone 8.1

Add as link feature.

  • This approach is suitable for app logic that's common to both apps but not portable, for some reason. You can use this feature for C# or Visual Basic code.

    For example, Windows Phone 8 and Windows 8 share Windows Runtime APIs, but Portable Class Libraries do not support Windows Runtime for those platforms. You can use Add as link to share common Windows Runtime code between a Windows Phone 8 app and a Windows Store app that targets Windows 8.

For details, see:

Write Windows Store apps using the .NET Framework or call Windows Runtime APIs from .NET Framework code

Windows Runtime APIs from your .NET Framework C# or Visual Basic code, and use the .NET Framework to create Windows Store apps. You should be aware of API differences between the two platforms. However, there are classes to help you work with those differences.

For details, see:

Build .NET Framework apps for non-Microsoft platforms

Portable Class Library reference assemblies in the .NET Framework, and a Visual Studio extension or third-party tool such as Xamarin.

For details, see:

Use JavaScript and HTML for cross-platform development

Universal App templates in Visual Studio 2013, Update 2 to develop against Windows Runtime APIs for Windows 8.1 and Windows Phone 8.1. Currently, you can’t use JavaScript and HTML with .NET Framework APIs to develop cross-platform apps.

For details, see:

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft