Skip to content

Commit 2509345

Browse files
baronfelgewarren
andauthored
Add an example of installing multiple SDKs while not corrupting installs (#47462)
* Add an example of installing multiple SDKs while not corrupting installs * fix linting * Apply suggestions from code review Co-authored-by: Genevieve Warren <[email protected]> --------- Co-authored-by: Genevieve Warren <[email protected]>
1 parent fe6d490 commit 2509345

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

docs/core/tools/dotnet-install-script.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,48 @@ The install scripts do not update the registry on Windows. They just download th
288288
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin <additional install-script args>
289289
```
290290

291+
- Install multiple versions while not overwriting `dotnet` binaries from prior installs.
292+
293+
If you install .NET SDKs or the .NET runtime from an earlier version on top of a newer version, you need to use `--skip-non-versioned-files` so that
294+
the 'unversioned' `dotnet` files from the earlier version don't overwrite the same files from the newer version.
295+
296+
```shell
297+
:~ $ ./dotnet-install.sh --channel 9.0 --install-dir local-dotnet # installs the latest 9 SDK to the specified directory
298+
dotnet-install: Attempting to download using aka.ms link https://builds.dotnet.microsoft.com/dotnet/Sdk/9.0.303/dotnet-sdk-9.0.303-linux-x64.tar.gz
299+
dotnet-install: Remote file https://builds.dotnet.microsoft.com/dotnet/Sdk/9.0.303/dotnet-sdk-9.0.303-linux-x64.tar.gz size is 218004272 bytes.
300+
dotnet-install: Extracting archive from https://builds.dotnet.microsoft.com/dotnet/Sdk/9.0.303/dotnet-sdk-9.0.303-linux-x64.tar.gz
301+
dotnet-install: Downloaded file size is 218004272 bytes.
302+
dotnet-install: The remote and local file sizes are equal.
303+
dotnet-install: Installed version is 9.0.303
304+
dotnet-install: Adding to current process PATH: `$HOME/local-dotnet`. Note: This change will be visible only when sourcing script.
305+
dotnet-install: Note that the script does not resolve dependencies during installation.
306+
dotnet-install: To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
307+
dotnet-install: Installation finished successfully.
308+
:~ $ ./local-dotnet/dotnet --list-runtimes # see what runtimes we have available
309+
Microsoft.AspNetCore.App 9.0.7 [$HOME/local-dotnet/shared/Microsoft.AspNetCore.App]
310+
Microsoft.NETCore.App 9.0.7 [$HOME/local-dotnet/shared/Microsoft.NETCore.App]
311+
:~ $ ./local-dotnet/dotnet --list-sdks # see what SDKs we have available
312+
9.0.303 [$HOME/local-dotnet/sdk]
313+
:~ $ ./dotnet-install.sh --channel 8.0 --install-dir local-dotnet --skip-non-versioned-files # install the 8 SDK to the same place, but keep the 9 dotnet binaries
314+
dotnet-install: Attempting to download using aka.ms link https://builds.dotnet.microsoft.com/dotnet/Sdk/8.0.412/dotnet-sdk-8.0.412-linux-x64.tar.gz
315+
dotnet-install: Remote file https://builds.dotnet.microsoft.com/dotnet/Sdk/8.0.412/dotnet-sdk-8.0.412-linux-x64.tar.gz size is 216096947 bytes.
316+
dotnet-install: Extracting archive from https://builds.dotnet.microsoft.com/dotnet/Sdk/8.0.412/dotnet-sdk-8.0.412-linux-x64.tar.gz
317+
dotnet-install: Downloaded file size is 216096947 bytes.
318+
dotnet-install: The remote and local file sizes are equal.
319+
dotnet-install: Installed version is 8.0.412
320+
dotnet-install: Adding to current process PATH: `$HOME/local-dotnet`. Note: This change will be visible only when sourcing script.
321+
dotnet-install: Note that the script does not resolve dependencies during installation.
322+
dotnet-install: To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the "Dependencies" section.
323+
dotnet-install: Installation finished successfully.
324+
:~ $ ./local-dotnet/dotnet --list-runtimes # we should have 8 and 9 Runtimes now
325+
Microsoft.AspNetCore.App 8.0.18 [$HOME/local-dotnet/shared/Microsoft.AspNetCore.App]
326+
Microsoft.AspNetCore.App 9.0.7 [$HOME/local-dotnet/shared/Microsoft.AspNetCore.App]
327+
Microsoft.NETCore.App 8.0.18 [$HOME/local-dotnet/shared/Microsoft.NETCore.App]
328+
Microsoft.NETCore.App 9.0.7 [$HOME/local-dotnet/shared/Microsoft.NETCore.App]
329+
:~ $ ./local-dotnet/dotnet --list-sdks # we should have 2 SDKs now
330+
8.0.412 [$HOME/local-dotnet/sdk]
331+
9.0.303 [$HOME/local-dotnet/sdk]
332+
291333
## Set environment variables
292334

293335
Manually installing .NET doesn't add the environment variables system-wide, and generally only works for the session in which .NET was installed. There are two environment variables you should set for your operating system:

0 commit comments

Comments
 (0)