Install .NET 8 and 9 SDKs on a Non-System Drive

Raymond Raymond event 2024-04-28 visibility 240
more_vert

This tutorial shows you how to install .NET 8 latest LTS (long-term support) SDK and .NET 9 preview SDK to a different drive from system drive C in Windows 10 or 11. 

Note - this is useful it you have limited space in C drive.

Download dotnet-install.ps1

First, we need to download dotnet-install.ps1 PowerShell script:

https://dot.net/v1/dotnet-install.ps1

Run the script

Open a PowerShell window in Windows terminal and change director to where the above shell script was downloaded to and then run the following command to install the latest LTS version of the SDK:

.\dotnet-install.ps1 -Channel LTS -InstallDir D:\dotnet

The above command line installs the SDK to dotnet folder in D drive. Please change accordingly.

You may get security warning since the script is downloaded from Internet and you need to run it by typing R:

Security warning

Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your

computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning

[D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"): R


Install a preview version

The following command line installs the latest preview version of 9.0 SDK to the same directory:

./dotnet-install.ps1 -Channel 9.0.1xx -Quality preview -InstallDir D:\dotnet


List SDKs

dotnet --list-sdks
8.0.204 [D:\dotnet\sdk]
9.0.100-preview.3.24204.13 [D:\dotnet\sdk]

Add environment variables

To make the tool available system-wide, please add these environment variables:

2024042835415-image.png

Also remember to add D:\dotnet and D:\dotnet\tools into Path system environment variable.

Reference

dotnet-install scripts - .NET CLI | Microsoft Learn

More from Kontext
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts