Skip to content

DevContainer supports dotnet 7 incompatible with the blueprints #1586

@wassimz

Description

@wassimz
Overview of the issue

The blueprint generate a codebase using dotnet version 9, incompatible with the supported devcontainer dotnet version 7

Motivation for or Use Case

Use the devcontainer feature generated by default.

Reproduce the error

run the command
jhipster-dotnetcore

Suggest a Fix

A quick turn around is to update the devcontainer files. Below is what I am using:

the devcontainer configuration file:

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
{
  "name": "C# (.NET)",
  // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
  // "image": "mcr.microsoft.com/devcontainers/dotnet:0-7.0",

  "build": {
    "dockerfile": "./Dockerfile",
    "context": ".."
  },

  "features": {
    "ghcr.io/devcontainers/features/node:1": {}
  },

  // Features to add to the dev container. More info: https://containers.dev/features.
  // "features": {},

  // Use 'forwardPorts' to make a list of ports inside the container available locally.
  "forwardPorts": [5000, 5001],
  // "portsAttributes": {
  //    "5001": {
  //      "protocol": "https"
  //    }
  // }

  // Use 'postCreateCommand' to run commands after the container is created.
  // "postCreateCommand": "dotnet restore",

  // 👇🏼 Trust the development certificates, run each time the
  // container is successfully started
  "postStartCommand": "dotnet dev-certs https --trust",

  // Configure tool-specific properties.
  "customizations": {
    "vscode": {
      // Add the IDs of extensions you want installed when the container is created.
      "extensions": [
        "ms-dotnettools.csharp",
        "ms-vscode-remote.remote-containers",
        "ms-vscode-remote.vscode-remote-extensionpack",
        "ms-dotnettools.dotnet-interactive-vscode",
      ]
    }
  }
  // "remoteUser": "root",
  // "mounts": [
  //  "source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume",
  //  "source=${localWorkspaceFolderBasename}-client-node_modules,target=${containerWorkspaceFolder}/src/DData/ClientApp//node_modules,type=volume",
  // ],
  // "postCreateCommand": "sudo chown node node_modules",
}

and a dockerfile as follow

# Use the most recent .NET LTS as the base image
FROM mcr.microsoft.com/devcontainers/dotnet:1-8.0

# Install the current .NET STS release on top of that
COPY --from=mcr.microsoft.com/dotnet/sdk:9.0 /usr/share/dotnet /usr/share/dotnet

# Finally install the most recent .NET 10.0 preview using the dotnet-install script
# COPY --from=mcr.microsoft.com/dotnet/nightly/sdk:10.0.100-preview.2 /usr/share/dotnet /usr/share/dotnet
JHipster Version(s)
  • Jhipster 8.10
  • Blueprint dotnetcore 4.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions