Docker Compose Environment Variables .NET version
I have multiple versions of the .NET SDK installed on my machine. However which does Rider choose as its DOTNET_VERSION
and ASPNET_VERSION
.
I have experienced the following issue…
When recently upgrading to .NET 8, an existing docker compose stopped working as both DOTNET_VERSION
and ASPNET_VERSION
still existed on the previous version of .NET 7.0.10.
I manually added this inside the docker compase:
environment:
DOTNET_VERSION=8.0.1
ASPNET_VERSION=8.0.1
Ran the image, and this seemed to rectifty this issue. Even after removing the environment variables, rebuilding and running the image again, the dotnet version 8.0.1 still persisted.
So question is where does Rider get this dotnet version from - does it just persist from the last used?
Please sign in to leave a comment.
Tom Bushell, usually the dotnet SDK version is only specified in DockerFile, not in the compose file, you should able to setup the SDK version like:
And the dotnet runtime/SDK version should not be impacted with your local installed SDK versions (no relationship). Newly created projects will always use the latest SDK version unless you specify the SDK version in the project root with global.json.
So, the issue should be from your docker-compose file and the DockerFiles. Could you share the files for further checking?