简体   繁体   中英

Different builds of SQLite in the same Windows Store app bundle

I'm having a problem deploying an update of my app to the store.

The app runs SQLite, and I've recently discovered it throws an error on certain x64 architectures.

BadImageFormatException: An attempt was made to load a program with an incorrect format.

I understand what this means. The x64 version of the app is using the x86 compiled version of sqlite3.dll . I can get around this issue and build an x64 version by the following method.

  1. Open Project > Properties, and set Platform and Platform Target to x64.
  2. Save
  3. Open Build > Configuration Manager and set Active Platform and Platform (Release) to x64.
  4. Build the project
  5. Open Project > Store > Create App Packages and generate my package

项目>属性

构建>配置管理器

This creates a correct x64 app package with the x64 version of sqlite3.dll

Following this for all three architectures (x86, x64 and ARM) gives me three separate appxbundle files. When I go to upload a new package to the store through the developer dashboard, I can only upload one of these.

If I open "Create App Packages" and choose all three architectures for my bundle, it generates a single appxbundle for all three. However when I unzip this appxbundle I can see that the x64 build is using the x86 compiled sqlite3.dll and not the x64 version.

I tried opening the appxbundle in 7zip and replacing the files, but 7zip could not write to the file, only read it.

I then tried unzipping the appxbundle and replacing each of the three builds with the correct builds from the singular appxbundles. I then zipped the lot together using no compression and renamed .zip to .appxbundle , but the store rejected this as an invalid file.

在此处输入图片说明

I'm guessing there's some kind of signing going on or a proprietary compression. To be honest I didn't expect that to work but it was worth a try.

How do I build the correct version of my app for each architecture and include it in a single appxbundle ? Can I manually create my own appxbundle from separate builds?

SOLUTION

I have accepted crea7or's answer below, but I just wanted to expand on it a little

Using the MakeAppX.exe command line tool I was able to unbundle and rebundle my appxbundle file correctly, using the following command

// to unbundle 
MakeAppX.exe unbundle /p MyPackage.appxbundle /d MyPackage
// to bundle
MakeAppX.exe bundle /d MyPackage /p MyPackage.appxbundle

A couple of handy pointers. Make sure you use the 8.1 version of MakeAppX, as the 8.0 version cannot bundle or unbundle.

C:\\Program Files (x86)\\Windows Kits\\8.1\\bin\\x86\\makeappx.exe

You'll save yourself a lot of hassle and typing if you simply add this path to your PATH Environment Variables in Advanced system settings. That way you can run MakeAppX from any location. This might seem obvious to people of my generation but not everyone is so familiar with DOS. =)

在此处输入图片说明

Visual Studio creates .appxupload packages, which according to this question , are zip files renamed as .appxupload . MakeAppX cannot create or unbundle .appxupload packages - you have to use a zip app.

However, any .appxupload package I created with 7zip did not validate when uploaded. Luckily it seems that the store will accept the .appxbundle directly, so I didn't need to zip it up at all, only bundle it. I've submitted this to the store. I'll report back if it gets approved.

update

the above appxbundle file was not approved, failed technical tests. I tried the zip approach again and it was accepted this time, again I'll report back if this passes.

To sum up:

c:\MyApp.appxupload -> [unzip] -> c:\MyApp\
c:\MyApp\MyApp.appxbundle -> [makeappx unbundle] -> c:\MyApp\MyApp\
c:\MyApp\MyApp\MyApp.appx -> [do whatever you need to here]
c:\MyApp\MyApp\ -> [makeappx bundle] -> c:\MyApp\MyApp.appxbundle
c:\MyApp\ -> [zip] -> c:\MyApp.zip
c:\MyApp.zip -> [rename] -> c:\MyApp.appxupload

You should use MakeAppx tool to create valid appx package bundle, because they are signed. Here is the tutorial about creating bundles.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM