Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the dotnet SDK version for the particular build?

I have both dotnet SDK 6 (6.0.101) and 5 (5.0.406) installed. So when I build the code SDK 6 is used. I would like to check if my changes would build cleanly when SDK 5 is used. I do not want to uninstall SDK 6. Is it possible to instruct the particular command line build to use SDK 5?

like image 634
mark Avatar asked Oct 27 '25 07:10

mark


1 Answers

How dotnet picks a .NET SDK version is explained at Select the .NET version to use.

To use the specific SDK version, add global.json file to the root of your solution or a project with the settings:

{
  "sdk": {
    "version": "5.0.406"
  }
}
like image 119
mark Avatar answered Oct 29 '25 05:10

mark



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!