Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying a Windows 8 Metro application that uses SQLite

Background

We're using System Center 2012 to deploy a Windows 8 Metro-style application to Samsung slates in the field running Windows 8 Enterprise x64. The slates are joined to the domain and have a persistent DirectAccess connection back to it, allowing System Center to push applications and updates to the devices.

We have to deploy our application to potentially hundreds of devices in the field, which is why we went the System Center route. The code signing cert is installed on every device using Group Policy. To deploy the application, you simply provide the package output and specify the collection of devices to install it on. The app just shows up on the device in a few minutes.

The problem we're having is that when System Center deploys our application, the SQLite dependency is lost and none of our data access works.

About our project

Our application is a WinJS application that uses SQLite as a backend. However, all our data access code is in a C# WinMD project which the WinJS project references. We're using the sqlite-net library to talk to SQLite - we included the source for that in our C# project.

In Visual Studio, we installed the SQLite for Windows Runtime extension as described in Tim Heuer's article. The Metro application references this.

Testing using other deployment methods

SQLite data access from the application works fine when you debug or run it locally - in both Debug/Release and x86/x64.

The app packaging process provides a PowerShell script that you can use to install the application and a developer license if necessary. When installing our app using the PowerShell script, SQLite data access also works fine. Verified this by packaging and installing both Debug/Release and x86/x64 versions of the app.

Troubleshooting

When the application first tries to use SQLite, we see an exception about it not being able to find the sqlite3.dll.

We've tried/verified the following:

  • Confirm that we're deploying a Release/x64 build
  • Examine the appx in WinRAR and verify that it contains the sqlite3.dll
  • Reference the "SQLite for Windows Runtime" extension from the C# project instead of the WinJS project
  • Also reference the C++ runtime, this caused System Center to fail when deploying the app. Don't know why yet, but looking into it.

UPDATE The issue is that System Center is having trouble deploying the Visual C++ Runtime Library dependency that the SQLite library needs. So unfortunately this isn't a programming question anymore. We're getting some help on this and I'll post the fix.

like image 411
George Durzi Avatar asked Sep 07 '12 19:09

George Durzi


1 Answers

I wanted to post the details of a temporary fix that we're going with. We've also gotten closer to the root of the problem, so I wanted to provide those details as well.

Recap of Issue

When referencing the Visual C++ Runtime Package from our Metro project, System Center is unable to deploy the application to the devices because there is a problem deploying the proper version of the dependency for the appropriate architecture and build flavor.

Our development machines running Visual Studio 2012 (and packaging the project for deployment) are using a newer version of the Visual C++ Runtime (50727) than what is available in a fresh installation of Windows 8 (50712).

Worked with the System Center team and confirmed that this was a bug in the version we were using and has already been addressed in future builds. We're going to work on upgrading the environment but that will take a couple of weeks.

Workaround

I confirmed and tested the following workaround:

  • Remove the reference to the Microsoft Visual C++ Runtime Package from the Metro project
  • Install the x64 version of the Visual C++ Redistributable for Visual Studio 2012 - http://www.microsoft.com/en-us/download/details.aspx?id=3
  • Deploy the application

Works like a charm because the correct version of the dependency is there already. Obviously not a long term solution if we choose to also target x86 and ARM, but will get us over this hump.

like image 187
George Durzi Avatar answered Nov 13 '22 07:11

George Durzi