.Net Core on IoT: Some Deployment key points
iot powershell dotnetcore iothub azure iot-core raspbian dotnetio
A few short hints on running .NET Core Az IoT Hub apps on the RPi.
- 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
- 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 ftpdin 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)
- When I rebuild/republish, after some changes to project code do I need to recopy all of the publish folder?
- 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
- What is the best/simplest test for .Net Core Installation
dotnetmay work but doesn’t check deep enough.
- If manually setting up .Net Core what environment variables do I need?
dotnet_rootThat 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
- 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 appbefore 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: >||.Net Interactive and Try .Net|
|This Category Links|
|Next: >||az-iothub-ps||Device Provisioning Service scripts added|
|< Prev:||Now for some HW on the RPi||IoT Hub Device Streaming Apps that Send & Recv real data - 2 more apps|