.NET 6 & .NET 8 auf einem Ubuntu-Server installieren und ansprechen

To install .NET 6 and .NET 8 in parallel on Ubuntu Server and access these versions, follow these steps:

  1. Add Microsoft Package Signing Key to your list of trusted keys and add the package repository: First, update the package index and install the required dependencies:
   sudo apt-get update; \
   sudo apt-get install -y apt-transport-https && \
   sudo apt-get update && \
   sudo apt-get install -y dotnet-sdk-6.0 dotnet-sdk-8.0
  1. Install .NET SDKs: You can install both .NET 6 and .NET 8 SDKs using the following commands:
   sudo apt-get install -y dotnet-sdk-6.0
   sudo apt-get install -y dotnet-sdk-8.0
  1. Accessing the Specific .NET Versions: After installation, you can specify which version of the .NET SDK to use for a specific project by using a global.json file in the project directory. To specify the SDK version, create a global.json file with the following content: For .NET 6:
   {
     "sdk": {
       "version": "6.0.0"
     }
   }

For .NET 8:

   {
     "sdk": {
       "version": "8.0.0"
     }
   }

Alternatively, you can use the dotnet --list-sdks command to list all installed SDKs and dotnet --version to see the default SDK version. Use the dotnet new globaljson --sdk-version <version> command to generate a global.json for a specific version.


Beitrag veröffentlicht

in

,

von

Schlagwörter:

Wir benutzen Cookies um die Nutzerfreundlichkeit der Webseite zu verbessen. Durch Deinen Besuch stimmst Du dem zu.