Pulls in a couple of scripts (slightly modified) we were using in Aspire to help with the dev time experience.
Background:
.\build.cmd will download and install the version of the .NET SDK specified in global.json to a local folder (the .dotnet folder). It then uses that SDK to build
But if you open VS or VS Code directly, it doesn't know about that local version of the .NET SDK and will just use what is installed globally
The new .\startvs.cmd and .\start-code.cmd will set the DOTNET_ROOT environment variable to the local installation of the .NET SDK before launching VS or VS Code so it'll be properly located
A couple notes:
If .sln files aren't already associated with a particular instance of VS, the first launch of .\startvs.cmd may not work right (it seems to lose the environment variables when you have to select the instance of VS to launch). But subsequent launches should work
You can still get into a mangled state if a) you have some local installs of the .NET SDK b) the .NET SDK in global.json is not installed locally, and c) the .NET SDK in global.json is installed globally. In that case .\build won't install it locally, but VS/VSC won't see the global one because the local directory overrides the global one. In that case either delete the .dotnet folder or uninstall the global version.
Pulls in a couple of scripts (slightly modified) we were using in Aspire to help with the dev time experience.
Background:
.\build.cmd
will download and install the version of the .NET SDK specified in global.json to a local folder (the.dotnet
folder). It then uses that SDK to build.\startvs.cmd
and.\start-code.cmd
will set theDOTNET_ROOT
environment variable to the local installation of the .NET SDK before launching VS or VS Code so it'll be properly locatedA couple notes:
.sln
files aren't already associated with a particular instance of VS, the first launch of.\startvs.cmd
may not work right (it seems to lose the environment variables when you have to select the instance of VS to launch). But subsequent launches should work.\build
won't install it locally, but VS/VSC won't see the global one because the local directory overrides the global one. In that case either delete the.dotnet
folder or uninstall the global version.