Skip to content

[BUG] C# solution generation broken #621

Description

Description

When I generate a new C# module, there is no module.json generated. This seems to cause problems in the build stage, meaning that the placeholder is not populated in the generated deployment file as follows.

"image": "${MODULES.SampleModule}",

This happens when you add a new #C module, or when you start from scratch with iotedgedev new.

Expected behavior

Basic project generation works - I can build and deploy the new module

Actual behavior

Basic project generation doesn't work - I can't build and deploy the new module.

Steps to Reproduce

mkdir test-solution
cd test-solution
iotedgedev new TestSolution # defaults to #C

The generated filtermodule has no module.json file.

When you build with iotedgedev build you get a deployment.amd64.json in the config directory with the following:

"image": "${MODULES.filtermodule}", - This is invalid and won't deploy correctly.

I think the generation and deployment of C# modules needs to be tested to make sure the build steps work. It just seems broken right now.

Environment

iotedgedev, version 2.1.0
Python 3.11.4
pip 23.1.2

Activity

  1. iainwhiteigs commented on Feb 27, 2024

    @iainwhiteigs
    Author

    Additional info - The only way I can get the deployment config to generate properly is to create a module.json file with the following content. Without the platform details it fails to generate - however since there is now no Dockerfile in the c# .net 7 modules this doesn't really make sense does it?

    {
        "$schema-version": "0.0.1",
        "description": "",
        "image": {
          "repository": "acragrisandboxukw.azurecr.io/filtermodule",
          "tag": {
            "version": "0.0.1",
            "platforms": {
                "amd64": "./Dockerfile.amd64", 
                "amd64.debug": "./Dockerfile.amd64.debug"
            }
          },
          "buildOptions": [],
          "contextPath": "./"
        },
        "language": "csharp"
    }
    
  2. konichi3 commented on Feb 27, 2024

    @konichi3

    We are aware of this issue and apology for the inconvenience.

    Meanwhile, please follow these steps in this page.

  3. iainwhiteigs commented on Feb 28, 2024

    @iainwhiteigs
    Author

    We are aware of this issue and apology for the inconvenience.

    Meanwhile, please follow these steps in this page.

    Koichi Hirao - AWS (@konichi3), I don't know how the steps on that page help me - They seem to be about running edge locally - that's not my issue and there's nothing in there to help me generate a deployment manifest.

    I'm manually generating the module.json defined above as a work-around, but it seems wrong that I need to specify Dockerfiles even though there are no longer Docker files in the dotnet7 modules. (Since dotnet publish is now being used)

  4. RollsChris commented on Mar 8, 2024

    @RollsChris

    same issue here

  5. iainwhiteigs commented on Mar 8, 2024

    @iainwhiteigs
    Author

    Hi Christopher Rollings (@RollsChris) I got a working C# module but I am a bit disappointed I had to go through the pain myself. I had to create a module.json and my own build script. Let me know if you need help and I can share them with you.

    I am surprised the change to .NET 7 seems to have been pushed out without any form of verification.

  6. RollsChris commented on Mar 15, 2024

    @RollsChris

    Thanks Iain White (@iainwhiteigs) we have something working

  7. bagoette commented on May 23, 2024

    @bagoette

    Any updates on this?

  8. aconway-igs commented on Feb 4, 2025

    @aconway-igs

    Is there any update on this issue?

  9. RollsChris commented on Feb 6, 2025

    @RollsChris

    last commit over 11 months ago :O is this repo dead?

  10. konichi3 commented on Feb 12, 2025

    @konichi3

    Hi,

    To resolve the issue that module template is not generated, our recommendation is to use the latest IoTEdgeDev tool v3.3.8

    OR

    follow the manual steps to generate the module template in the blog pasted earlier. Please see the section "Create a dotnet Module" for steps.

  11. john10e commented on Mar 7, 2025

    @john10e

    Koichi Hirao - AWS (@konichi3) you recommend using latest IoT EdgeDev tool v.3.3.8, but how do I install that on my dev workstation, I only see the source from your link above.

    I also created a module using the 'blog' method you recommend above, but what do I do with it then? When I try to add it to VS2022 project created via 'IoT Edge VS extension' as a Module reference, I get an error saying it's not a valid Edge Module project.

    I'm following this tutorial to get started. I'm stuck with a VS2022 project that I cannot add modules to, even after downloading the templates files described as a workaround in this document. Same problem with VS Code and following EFLOW documentation.

    Also tried following the manual install of IoT EdgeDev described in this WIKI (which now results in a 404) and keep getting python errors even after downgrading python to 3.9.

    It shouldn't be this difficult to get started coding and debugging custom modules for IoT edge. Perhaps someone forward a link to a sample VS2022 or VS Code solution I can start from?

  12. iainwhiteigs commented on Mar 8, 2025

    @iainwhiteigs
    Author

    Koichi Hirao - AWS (@konichi3) I agree with john10e - I have struggled for hours trying to get the v3.3 version to install on macOS with various different python versions. It should not be this difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriageIssues that need to be looked at

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions