A few short hints on running .NET Core Az IoT Hub apps on the RPi.

  1. Should I build and deploy Self-Contained or Framework Dependant .Net Core apps?
    • Self Contained Pro: You don’t need to set up .NET Core on the target
    • Self Contained Con: Downloads are bigger and so take longer. Multiple of such apps can fill the target storage.
    • Framework Dependant Pro: Small downloads, small storage required
    • Framework Con: Got to setup .Net Core on the device
    • I use Self-Contained for Raspbian
    • I use Framework Dependant for IoT-Core
  2. Is a File Share better for downloads than FTP
    • File Share is quicker, particularly when there are a lot of files (eg sef-contained)
    • Unless configured otherwise, you have to start the ftp service on the target
    • eg IoT-Core start ftpd in PowerShell - FTP is less problematic to get going than a File Share - I use File Share for Raspbian
    • I set the Publish folder in Visual Studio to the share - I use FTP with IoT-Core
    • Nb: I use FileZilla for FTP
    • You can quickly copy individual files
    • Each file copy is individual so a Self-Contained upload takes ages
    • You can though directly edit a file that has been uploaded.
    • Be sure to set uploads/downloads to Auto (or binary)
  3. When I rebuild/republish, after some changes to project code do I need to recopy all of the publish folder?
    • No
    • For small code changes just copy the app binary and app.dll
    • For IoT-Core that is app.exe and app.dll
    • For Raspbian thats a file just no extension app and app.dll - Structural changes to the project would require a full recopy
  4. What is the best/simplest test for .Net Core Installation
    • dotnet may work but doesn’t check deep enough.
    • Use dotnet --info
  5. If manually setting up .Net Core what environment variables do I need?
    • dotnet_root That points to the folder where you placed the expanded .NET Runtime or SDK binary on the device.
    • That same folder needs to be added the the device’s System Path.
    • Alternatively for IoT-Core, just place the contents in C:\Program Files\dotnet
  6. If using a File Share, what direction should it be?
    The shared folder can be on the desktop (you connect from the device, or on the device (you connect to the device).
    • I found Share-the-Device best:
    • Its easy to publish from Visual Studio directly to the share
    • I found with Linux/Raspian you had change the access permission of the app to executable using chmod +x app before the app would run if you use Share-the-Desktop.
    • If Share-the Device, when copied, the files were of the required status

In all six points above, it assumed that the project source remains on the desktop and the app is built/published there.

  • For that you do not need the SDK on the target, only the Runtime if deploying Framework-Dependant.
  • You do not need either if deploying self-contained.

What if the project is to be built on the target?

  • On the RPi, for example, builds are significanly slower but are do-able for smaller apps.
  • One suggested advantage for Share-the-Desktop is that the project files can remain on the desktop including the built binaries.
  • (Repeat) I found though with Linux/Raspbian you had to change the access permission of the app to executable before the app would run if you use Share-the-Desktop.

  Next: >  
 This Category Links 
Category:IoT Index:IoT
  Next: > az-iothub-ps
<  Prev:   Now for some HW on the RPi