Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Choose the SDK version (e.g. preview3 vs preview2) that the dotnet CLI uses

We have three versions of the dotnet command line interface installed:

C:\Program Files\dotnet\sdk> dir -name
1.0.0-preview2-003133          
1.0.0-preview2-1-003177        
1.0.0-preview3-004056          

How can we choose which version to use when running for instance dotnet restore? Right now the version is always the preview3 build.

Our PATH contains C:\Program Files\dotnet\ which contains:

host                           
sdk                            
shared                         
swidtag                        
dotnet.exe                     
LICENSE.txt                    
ThirdPartyNotices.txt          

How do we choose which SDK the dotnet.exe uses?

like image 934
Shaun Luttin Avatar asked Nov 20 '16 01:11

Shaun Luttin


People also ask

What is my .NET SDK version?

You can see both the SDK versions and runtime versions with the command dotnet --info . You'll also get other environmental related information, such as the operating system version and runtime identifier (RID).

Does .NET SDK include runtime?

The runtime includes everything you need to run . NET Core applications. The runtime is also included in the SDK.

What is the use of global json in .NET core?

The global. json file allows you to define which . NET SDK version is used when you run . NET CLI commands.


1 Answers

You choose which CLI you use by placing a global.json file into the current directory or a directory above it.

For example, to select 1.0.0-preview2-003133, the file would look like this:

{
  "sdk": { "version": "1.0.0-preview2-003133" }
}
like image 193
svick Avatar answered Sep 27 '22 16:09

svick