Microsoft.IoT.Lightning Nuget package
This repository is for generating the Microsoft.IoT.Lightning Nuget package. This package contains code which is compiled into an application deployed to a board running Microsoft Windows IoT Core.
Also, the nuget package is periodically published to nuget.org. For more information on installing the published nuget package, please refer to https://www.nuget.org/packages/Microsoft.IoT.Lightning/
Build the Nuget package
- nuget.exe is required to build the Nuget package, so please download the Nuget command line utility nuget.exe and make sure it's in the PATH.
- Visual Studio 2017 is also required to build the sources (Visual Studio Downloads)
- Clone or download this repository
- Assuming F:\Github\lightning is your local repo root folder and all prerequisites above are met, run this command to both build the sources and create the Nuget package.
- Alternatively, if the sources are already built, run this command from the \Nuget folder to create the Nuget package only.
Set Nuget package source location
In order to install Nuget packages from your local builds, you'll need to add the folder where the Nuget package has been created (or copied) to the list of nuget package manager sources in Visual Studio. Following the below instructions for each sdk source:
In Visual Studio 2017, nativate to Tools -> Library Package Manager -> Package Manager Settings
- Click the "+" button to add a new source
- Set the name to something descriptive
- Click the "..." button and navigate to your local folder where the Nuget package has been created; e.g. F:\Github\lightning\Nuget
- Click the "Update" button to save the Package Sources changes
Including prerelease Lightning packages
In order to install the latest prerelease version of Lightning as well as receive prerelease updates to the Lightning package, make sure to set the "Include prerelease" option in the Nuget Package Manager.
- Right click References in your project
- Click "Manager Nuget Packages..."
- Select package sources for Lightning nuget
- Click "Include prerelease".
- Click "Install" to install the nuget package to your project
Add required UWP Extensions
The IOT and Desktop UWP SDK Extensions are both required for building Lightning applications.
- Right click "References" in your Visual C++ UWP Project
- Choose "Add Reference..."
- Open Universal Windows | Extensions
- Choose Both "Windows Desktop Extensions for the UWP" and "Windows IoT Extensions for the UWP".
Update Application Package manifest
Also, you need to update the Application Package manifest manually to reference the Lightning device interface.
- Right click "Package.appxmanifest" in your Visual C++ UWP Project
- Click "Open With.."
- In the "Open With" dialog box, choose XML (Text) Editor and click OK
- Edit the the Capabilities section in your application to add the following:
<iot:Capability Name="lowLevelDevices" /> <DeviceCapability Name="109b86ad-f53d-4b76-aa5f-821e2ddf2141"/>
- The first is a capability that will enable the application to access custom devices.
- The second is the device guid id for the Lightning interface
- Save the file
Build your project to verify all prerequisites to use Lightning were successfully added.