How to use deployment.template.json file with .net8 app containers for Iot Edge Modules

Michael Moles 5 Reputation points
2024-06-12T02:15:46.53+00:00

I am trying to migrate my modules from netcoreapp2.1to net8.0 and using the newer style of build and deployment. I am also trying to get away from all of the deprecated tools, so that's saying goodbye to the .iotedgeproj right click "Generate Deployment for IoTEdge"

I have no idea how to use deployment.template.json with the cli.

I can build everything fine with dotnet ``publish "C:\Users\TheCode\TheCode.csproj" -r linux-arm -c Release /t:PublishContainer but I was hoping to not have to write pre\post build script to populate the deployment.json

iotedgedev ``solution genconfig -P linux-arm will take the .env file and resolve some variables, but that is targeting module.json and not the project file or appsettings. Since i am using dotnet publish to build, it feels like there should be a way that supports this.

I tried running iotedgedev ``solution build --file deployment.template.json --platform arm32v7 but thats targeting the old dockerfiles from the module.json again, and it is a complete mess leaving a bunch of inactive containers as well as constantly failing because of an ERROR: Can not read file in context: C:\Users\TheCode\.vs\TheCode\FileContentIndex\367b6ce1-5024-4b68-a88b-5204a0aa88f3.vsidx

Is there a way to have iotedgedev use the dotnet publish instead of dockerfile?

I am dreading when I need to add all this to an Azure Build Pipeline for which the Azure IoT Edge - Build module images and Azure IoT Edge - Generate deployment manifest I believe is using iotedgedev , which wont work. The building of the modules I'll be able to use the .NET Core - dotnet publish at least.

Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
576 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.