×

First time here?

You are looking at the most recent posts. You may also want to check out older archives. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS or email. Thank you for visiting!

I’m just coming back from Build 2014 and it was a great pleasure to talk to customers/developers.  It is one of the best parts of my job right now in seeing how customers use the technology our team represents.  If you are a XAML developer and didn’t have a chance to go to Build or haven’t watched all the sessions, here’s a quick short list of recommendations I’d have:

There are many more (app model, localization, accessibility, tiles, notifications, etc.) so please do look at the event site and download/watch your favorites.  I think the list above gives you a good intro to the UI area changes and introduction to the concepts of Universal Windows apps.  If you haven’t heard of that concept yet, you can jump to the Keynote from Day 1 for the quick demo.

Add Reference

The last session above is one that I want to write about today in this post.  In current form, a Universal Windows app in Visual Studio Update 2 allows you to maximize your sharing of code/assets across your Windows Store and Windows Phone app.  If you are like most developers, you rely on a great ecosystem of libraries and SDKs to augment your app and add functionality, UI or make things easier to develop.  In our keynote sample, the app we migrated (SportsLeague app) used JSON.NET and we showed that we are able to re-use the same library (which in this case happened to be a Portable Class Library, aka PCL) across the different endpoints.

One thing that is important is that you will need to add these references to each of your project ‘heads’ (the term we use to describe each endpoint in a shared project solution).  For some that are using direct binary DLL references to PCL libraries should be okay.  For others that are using Extension SDKs and/or NuGet packages, you may find yourself into some scenarios where either the SDK is different or the NuGet package isn’t updated yet to understand the Windows Phone 8.1 project type.  There are a number of these that are already updated like JSON.NET, Caliburn.Micro, etc.  If you find yourself using a library that isn’t updated yet, you may want/need to prod the author to update.  Better yet, if it is Open Source, submit a pull request with the update yourself!

SQLite or other native Extension SDKs

The other category are things that might be platform-specific and/or native.  These things are generally more complex than something that might work in a PCL and have dependencies on various native compiler/linker options or have been compiled in such a way that are different for the Phone device versus a tablet device.  One such example is SQLite.

SQLite is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. The code for SQLite is in the public domain and is thus free for use for any purpose, commercial or private. SQLite is currently found in more applications than we can count, including several high-profile projects.

SQLite links against the C++ Runtime and as such needs to make sure the right linking happens for the phone and tablet CRT profiles.  Right now, the SQLite for Windows Phone Runtime 8.1 is in some testing, but since a lot of people have been asking me about it, I’ll share my private build from source of the SDK.  This comes with a “works on my machine” guarantee :-).  This is a build of SQLite from their source, which is Open Source, and modified to compile/link against the Windows Phone 8.1 SDK.  When the official version comes out you should update to that version from their site.  For now, you can download my build of  UPDATE (12-MAY-2014): SQLite team put out their official build for Windows Phone 8.1: SQLite for Windows Phone 8.1 here.

Updating your Extension SDKs and NuGet packages

If you are an author of one of these SDKs that people use, please consider doing an update to make your customers happy.  If you are an Extension SDK provider you will want to produces an Extension SDK for Windows Phone 8.1.  If you already have a WinRT SDK, then you may just be able to copy the manifest, etc. and just produce changes to your manifest so it installs to the right location.  Here is an example:

<Installation AllUsers="true" Scope="Global">
  <InstallationTarget Id="Microsoft.ExtensionSDK" 
    TargetPlatformIdentifier="WindowsPhoneApp" 
    TargetPlatformVersion="v8.1" 
    SdkName="SQLite.WinRTPhone81" SdkVersion="3.8.4.1" />
</Installation>

As you can see in lines 3,4 above the TPI/V values are different than your existing SDK which tell the SDK where to install.

If you are an author of a NuGet package, you also will want to make your package Windows Phone 8.1 aware.  Again, if you have an existing package that works with Windows 8.1, then you may just be able to duplicate the content/lib/tools to a folder labeled ‘wpa81’ and test that out.  Example NuSpec:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>
        <id>Callisto</id>
        <version>1.5.0</version>
        <title>Callisto</title>
        <authors>Tim Heuer</authors>
        <owners>Tim Heuer</owners>
    </metadata>
    <files>
        <file src="lib\portable-win81+wpa81" target="lib\portable-win81+wpa81" />
    </files>
</package>

If you see at line 11 the ‘portable-win81+wpa81’ it allows me to combine the two targets telling NuGet this applies to either.  Of course if I had any nuanced differences I could also just use ‘wpa81’ and put the phone-specific lib (or assets) there.

In both cases if you have any UI aspects, most likely you may want to do some work here to make sure that any UI assets are tailored to the device targets for a great experience.

I hope this helps clarify some of the reference questions that I’ve received and I hope that if you are an SDK author you will work quickly to help your customers realize their goals of a universal Windows app!

Hope this helps!


This work is licensed under a Creative Commons Attribution By license.


Gravatar
4/18/2014 7:40 PM | # re: Using SDK/library references in Universal Windows Apps
Hi Tim,
I am trying to get SQLite-WinRT to compile for WP8.1 but I am getting “error C1083: Cannot open include file: 'sqlite3.h': No such file or directory” from the WP project when I build after I add a reference to SQLite.

I have tried with using a blank universal app template and I get the same result.
I have uploaded the project to skydrive http://1drv.ms/1f5kg8P
I would be grateful if you could take a look and see if it builds on you machine.
Thanks
4/21/2014 8:03 AM | # re: Using SDK/library references in Universal Windows Apps
@Tim - I emailed Tim privately and the error seems to be from compiling the SQLite-WinRT library itself, which attempts to statically link the SQLite engine. I personally don't prefer that library and suggested to Tim to use the SQLite-Net library since he's using a .NET project anyway.
4/23/2014 3:31 PM | # re: Using SDK/library references in Universal Windows Apps
Hi Tim,
I wanted to create a Universal app using a PCL I just created for Windows/Phone 8.1. The View Models will be identical on both platforms. I went to add shared View Models and then realized there is no "references" for the Shared project. Thus, I couldn't add a reference to my PCL (located in the same project folder as the Win8.1 and WP8.1 project) inside the Shared folder. Am I missing something? Could you point me in the right direction if so? Or am I stuck with creating View Models for Windows 8.1 and Windows Phone 8.1 even though they are the exact same code?
4/24/2014 12:34 PM | # re: Using SDK/library references in Universal Windows Apps
@Tony - as indicated above you need to add the reference to each 'head' project. You can still use the PCL binary though.
4/24/2014 12:40 PM | # re: Using SDK/library references in Universal Windows Apps
My apologies! Works like a charm now!
4/27/2014 11:12 AM | # re: Using SDK/library references in Universal Windows Apps
Hi Tim

I'm trying to use the Sqlite library in a C++ universal WP8.1. Maybe I am wrong here, but I thought if I add a reference to my project to the library-file (the one listed in this post), it would be possible to use it. When I try to enter "using namespace Sqlite", VS2013 update 2, says it can't find it. I notice when I look at the reference, there is no "assembly name" in the "reference properties". could this be the issue, or maybe I lack some knowledege here :). Cheers.
4/27/2014 1:34 PM | # re: Using SDK/library references in Universal Windows Apps
@Martin - if you are in a C++ library, you can just use the C API provided by SQLite itself by doing #include <sqlite3.h> once you install the SDK. If you are wanting a WinRT-callable API, you may want to look at the various SQLite-WinRT libraries available. I don't have a favorite in this area when it is WinRT (I'm partial to the SQLite-net implementation for .NET)
4/28/2014 9:14 AM | # re: Using SDK/library references in Universal Windows Apps
Hi Tim. Got it installed and it's recognzed now. The usual problem of Pebcak, I'm afraid :) Ran through all the C++/general and Linker/general options again, made deleted them, pointed them to the SDK-installation folder, and now everything compiles. Tnx!
4/29/2014 10:41 AM | # re: Using SDK/library references in Universal Windows Apps
Fantastic job! Thank you very much.
4/30/2014 3:30 AM | # re: Using SDK/library references in Universal Windows Apps
Hi Tim, many thanks for making the Vsix Package for Windows Phone 8.1 available. Since there are many pitfalls (the Vsix for Windows 8.1 is not visible from VS2013, the “Any CPU” platform choice is not permitted, etc. etc.) I've written a post that illustrate step by step how to create a Universal App with SQLite. Hope can be of any help :-)

blog.tpcware.com/...
5/4/2014 2:44 PM | # re: Using SDK/library references in Universal Windows Apps
I've been using your build of SQLite for wpa81. Thanks so much for making it available. However, unfortunately it causes my wpa81 app to be rejected from the store due to illegal API usage:

◦This API is not supported for this application type - Api=CreateFileMappingFromApp. Module=api-ms-win-core-memory-l1-1-2.dll. File=sqlite3.dll.
◦This API is not supported for this application type - Api=MapViewOfFileFromApp. Module=api-ms-win-core-memory-l1-1-2.dll. File=sqlite3.dll.
◦This API is not supported for this application type - Api=UnmapViewOfFile. Module=api-ms-win-core-memory-l1-1-2.dll. File=sqlite3.dll.

Any idea when the real version, or a fix for this, will be available?
5/4/2014 7:21 PM | # re: Using SDK/library references in Universal Windows Apps
@Andrew - this is a false positive in the certification pipeline and is known as of this comment (04-May-2014). The fix is in flight now to production and hopefully there within a week. The issues is not with SQLite DLL.
5/9/2014 7:22 AM | # re: Using SDK/library references in Universal Windows Apps
Tim, thanks very much for posting your build for SQLite Windows Phone 8.1! I think it will be very helpful to be able to work on my universal app while the official build is coming from the SQLiteteam.

 
Please add 5 and 1 and type the answer here:

DISCLAIMER:

The opinions/content expressed on this blog are provided "ASIS" with no warranties and are my own personal opinions/content (unless otherwise noted) and do not represent my employer's view in any way.