Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple .NET SDK versions? #389

Closed
justinyoo opened this issue Jan 9, 2023 · 6 comments · Fixed by #628
Closed

Multiple .NET SDK versions? #389

justinyoo opened this issue Jan 9, 2023 · 6 comments · Fixed by #628
Labels
enhancement New feature or request

Comments

@justinyoo
Copy link

justinyoo commented Jan 9, 2023

Hi, Team.

I was wondering if it's possible to install multiple .NET SDKs in one devcontainer settings. For example, I'd like to install both .NET 7 and .NET 6 in one devcontainer environment.

What I tried was:

  1. In Dockerfile, select the base container image from mcr.microsoft.com/dotnet/sdk:7.0
  2. In devcontainer.json, run a shell script, say post-create.sh, through postCreateCommand.
  3. In post-create.sh, run the dotnet-install.sh script by following this document to install .NET 6.

However, it didn't go well as intended. Would you be able to provide some guidance to install multiple .NET SDK versions - STS and LTS?

Cheers,

@samruddhikhandale
Copy link
Member

Option 1 - The mcr.microsoft.com/devcontainers/universal:2 consists of .NET 7 & 6. Maybe you could use that as the base container image?

Option 2 - We have an experimental additionalVersions option for some of the Features to install more than one SDKs. The value specified for version option is set as default.

Can you try adding the following to .devcontainer.json?

"features": {
        "ghcr.io/devcontainers/features/dotnet:1": {
            "version": "7",
            "additionalVersions": "6"
        }
    }

@justinyoo
Copy link
Author

Oh, I might try the Option 2, then. Thanks!

@justinyoo
Copy link
Author

By the way, devcontainer-feature.json doesn't define the additionalVersions option, but install.sh defines it. Have you noticed that?

@samruddhikhandale
Copy link
Member

Option 2 - We have an experimental additionalVersions option for some of the Features to install more than one SDKs. The value specified for version option is set as default.

@justinyoo Yep, we had added it as an experimental option and hence, didn't document it. As we can see a request for it, we'd think of either formalizing that option or finding another better approach for this scenario.

@samruddhikhandale samruddhikhandale added the enhancement New feature or request label Jan 10, 2023
@kosperera
Copy link

Option 2 - We have an experimental additionalVersions option for some of the Features to install more than one SDKs. The value specified for version option is set as default.

Can you try adding the following to .devcontainer.json?

"features": {
        "ghcr.io/devcontainers/features/dotnet:1": {
            "version": "7",
            "additionalVersions": "6"
        }
    }

Hi @justinyoo were you able to make it work? I tried this Option 2 but the install script is not installing the additional versions.

@iMicknl
Copy link

iMicknl commented Apr 29, 2023

Adding additionalVersions does not work for me as well. With "image": "mcr.microsoft.com/devcontainers/universal:2" it fails on dotnet 6 already exists. While if I remove the dotnet feature, only dotnet 7 is present (runtime and SDK).

#0 80.55 Found .NET binary version 6.0.408
#0 80.83 (!) Dotnet version 6.0.408 already exists.
#0 80.83 ERROR: Feature "Dotnet CLI" (ghcr.io/devcontainers/features/dotnet) failed to install! Look at the documentation at https://github.com/devcontainers/features/tree/main/src/dotnet for help troubleshooting this error.
{
	"image": "mcr.microsoft.com/devcontainers/universal:2",
	"features": {
		"ghcr.io/devcontainers/features/node:latest": {},
		"ghcr.io/devcontainers/features/dotnet:latest": {
			"version": "7",
            "additionalVersions": "6"
		},
		"ghcr.io/jlaundry/devcontainer-features/azure-functions-core-tools:latest": {}
	},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
4 participants