locked
Issues with developing SDK for uwp apps RRS feed

  • Question

  • I am relatively new to Windows development and I am trying to develop a SDK targeting Win10 UWP apps.

    I have already written the SDK in C# and it uses some 3rd party dependencies via NuGet package namely :

    1. Newtonsoft JSON.

    2. Sqlite.Net PCL

    3. Sqlite.Net PCL Async

    I initially packaged the SDK as a dll file only but if C++ and Javascript apps need to consume the SDK they would need a winmd file for the SDK (as far as i understand.)

    Now, the issue is, the above mentioned nuget packages dont have winmd files or native compiled library which can be used in C++/javascript apps.

    So how do I get/use the dependent packages in a way that a UWP app can use my SDK?

    I made my SDK project to output a Windows Runtime Component i.e a winmd file. But how do I import the dependencies of my SDK in a Universal app?

    I am stuck on this for days now, any help is really appreciated. 

    Thank You!

    Friday, August 19, 2016 11:08 AM

All replies

  • Even if you have the PCL builds of all of these libraries, they need to be compiled as WinRT components. You'll need to check and see that Nuget has WinRT builds of all of the above libraries. If these are not forthcoming, you'll either need to use other libraries (there is a JSON library that comes with the PCL), or you'll need do the work to add a WinRT build yourself.

    KeepMyIdentities, Your Key to Password Security. Available now on the Windows Store: http://apps.microsoft.com/webpdp/en-US/app/keepmyidentities/61a9f340-97ac-4666-beab-39f9246cb6fa

    Friday, August 19, 2016 7:44 PM
  • Thanks for a quick reply.

    That clears some misconceptions I had.

    Can I create a  wrapper winmd build that exposes only my SDK apis and has references to the above dependencies internally?

    For example :

    SDK Project:

    • Newtonsoft JSON.
    • Sqlite.Net PCL
    • Sqlite.Net PCL Async

    Wrapper Project :

    • Wrapper code for SDK project.
    • Add reference to dll file of the above dependencies manually.
    • Build a winmd for this project. 

    Would the wrapper project package the added dependent dll files?

    If it does, would it run successfully? 

        
    Monday, August 22, 2016 6:55 AM
  • Just adding the assemblies may not be enough; you may need to copy the source into a project, add the winmd file, and build a WinRT component assembly. If this does work, however, you may try to contribute back the code to the upstream projects.

    When WinRT came out a few years ago, a lot of people wanted SQL libraries for it. You may want to dig through archived forums for Metro/Windows Store developmet to find what others have done.


    KeepMyIdentities, Your Key to Password Security. Available now on the Windows Store: http://apps.microsoft.com/webpdp/en-US/app/keepmyidentities/61a9f340-97ac-4666-beab-39f9246cb6fa

    Tuesday, August 23, 2016 1:47 AM
  • I tried various approaches to make this project work and found some success in the following:

    Following is the project structure I made along with dependencies :

    Client Application (in C++):

       1. Wrapper winmd library.

    Wrapper winmd library (in C#): (I generate a winmd component from this project)

       1. My SDK project

    My SDK project (in C#):

       1. SQLite Net.

       2. SQLite Net Async.

       3. Newtonsoft JSON.

    When I build the client application, I get the wrapperlibrary.winmd file but I dont get the corresponding dlls from the 3rd party dependencies in the output directory (SQLite and Newtonsoft). So i manually copied the required dlls to the output directory of the C++ application. Now it seems to work correctly, I can verify correct usage of the 3rd party libraries. Presently I am just trying to make the setup work as a poc and worry about the packaging later.

    The issue I now face is that my SDK also has some UI elements, so essentially compiled .xbf files for the "Page" I have. All the method calls work properly but as soon as i call into any UI from my SDK via the C++ app, it crashes.

    I tried the same approach as for dlls, I copied the xbf file manually to the output directory of the client application and also copied the corresponding .pri file and it still does not work for me.

    Is there anything else that I can try to make the UI elements work? 

    Is there some other way to export UI elements to the client UWP application?


    Wednesday, August 31, 2016 9:12 AM