A first hand look from the .NET engineering teams
Two weeks ago, we released the Windows Phone preview for developers. In this post, I’ll cover what this means for library and app developers.
As a .NET developer you can target Windows Phone 8.1 via two platforms:
Windows Phone 8.1. This is the new platform which is more converged with Windows and enables developers to share more code between Windows and Windows Phone apps.
Windows Phone Silverlight 8.1. This is an update to the existing Windows Phone platform; it allows developers to move their existing apps forward while taking advantage of new Windows Runtime APIs.
Apps that target Windows Phone Silverlight 8.1 can consume existing libraries and NuGet packages as-is – after all, it’s still Windows Phone Silverlight – just an updated version.
Apps that target the new Windows Phone 8.1 platform can only consume libraries and NuGet packages that are built for Windows Phone 8.1. But don’t worry – it’s easy to update your libraries to include support for Windows Phone 8.1.
If you’re already using a portable class library to target Windows Phone, then it’s even super trivial:
Right click your portable class library in Solution Explorer and select Properties. On the Library tab click on Change. This opens a dialog in which you can now add support for Windows Phone 8.1:
Note: If you have the Xamarin Tools installed you might get an error message telling you the selection doesn’t share any portable APIs. That’s a known issue with the current version of the Xamarin tools. Xamarin is working on providing an updated version. For now, the only workaround is to uncheck the Xamarin platforms.
For Windows Phone Silverlight 8 libraries, we recommend creating a new portable class library that targets Windows Phone 8.1 and Windows Phone Silverlight 8.1.
In case you’re redistributing your library via NuGet, you also need to indicate support for Windows Phone 8.1 by using the new lib folder name, which is wpa81. For example:
<package > <metadata> <id>MyLibrary</id> <!-- ... --> </metadata> <files> <!-- Support for portable --> <file src="MyLibrary.dll" target="lib\portable-net45+win8+wp8+wpa81" /> <!-- Windows Phone 8.1 specific library --> <file src="MyLibrary.Phone.dll" target="lib\wpa81" /> </files></package>
We’ve already updated our NuGet packages to add support for Windows Phone 8.1. This includes the following NuGet packages:
Windows 8.1 and Windows Phone 8.1 support a common set of APIs, with few exceptions. This allows you to very easily build your application such that it works on both Windows Phone as well as Windows. With Visual Studio 2013 Update 2, we’ve added a new feature called Universal Apps that makes this process a breeze. You find out more in the post Using Visual Studio to build Universal XAML Apps.
Many of the popular NuGet packages have already added support for Windows Phone 8.1, such as JSON.NET as well as our NuGet packages.
But it’s certainly possible that you’ll want to consume NuGet packages that aren’t enabled for Windows Phone 8.1 yet. In that case, you’ll see an error message like this:
If you hit such a case you should let the author of the package know by using the Contact Owners link on their NuGet page:
With the Windows Phone 8.1 tooling and OS preview have both been just released, we need the community’s help to update your NuGet packages. If you maintain a library that supports phone, you should update your project and NuGet package so that developers building universal Windows apps can leverage your work.
Would be nice if we could still support WP7.1 too. It seems you can either (WP7 and WP8) or (WP8 and WP81).
Can you add WP 8.1 support for Microsoft Unity? It is only one checkbox in PCL targets and update NuGet package. Now if i want to use Unity in WP 8.1 apps i'll need download Unity sources :(
@Nikolay: I've asked the Unity guys. It seems there is a pre-release coming this week that will add support for Windows Phone 8.1.
You can't install it via nuget,, but still possible to add the reference to dll directly from the disk. What happens ife we do so ?
@OnurG: The reason it "works" is because VS doesn't verify whether the referenced DLL can be used from your platform. In some cases you may get lucky and in others your app will fail so you're effectively in unsupported territory and thus we recommend against it.
Hi, I am Windows Phone developer, and I am using HttpClient in my application (Windows Phone 8.0). I found issue in HttpClient, which exists only on Windows Phone 8.1 devices. When app is sending request to server, and user navigate to start screen and after that return to app, usually HttpClient thrown Request Canceled exception, but sometimes no exception is thrown and returned Http content is truncated (HTTP status is 200 OK). This very critical issue, can anyone help me ?
When should we expect XNA 5.0? XNA 4.0 still doesn't support WP8 so even working with PCL gets harder.