startvscode.sh 671 B

1234567891011121314151617181920212223242526
  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 SDK.
  3. # This tells .NET 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. # Put our local dotnet on PATH first so Visual Studio knows which one to use
  7. export PATH="$DOTNET_ROOT:$PATH"
  8. # Sets TFW for Visual Studio Code usage
  9. export TARGET=net11.0
  10. if [ ! -f "$DOTNET_ROOT/dotnet" ]; then
  11. echo ".NET has not yet been installed. Run `./restore.sh` to install tools."
  12. exit 1
  13. fi
  14. if [[ $1 == "" ]]; then
  15. code .
  16. else
  17. code $1
  18. fi
  19. exit 1