startvscode.sh 792 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/env bash
  2. # This command launches a Visual Studio code with environment variables required to use a local version of the .NET Core SDK.
  3. # This tells .NET Core to use the same dotnet.exe that build scripts use
  4. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
  5. export DOTNET_ROOT="$DIR/.dotnet"
  6. # This tells .NET Core not to go looking for .NET Core in other places
  7. export DOTNET_MULTILEVEL_LOOKUP=0
  8. # Put our local dotnet on PATH first so Visual Studio knows which one to use
  9. export PATH="$DOTNET_ROOT:$PATH"
  10. # Sets TFW for Visual Studio Code usage
  11. export TARGET=net10.0
  12. if [ ! -f "$DOTNET_ROOT/dotnet" ]; then
  13. echo ".NET Core has not yet been installed. Run `./restore.sh` to install tools."
  14. exit 1
  15. fi
  16. if [[ $1 == "" ]]; then
  17. code .
  18. else
  19. code $1
  20. fi
  21. exit 1