Skip to content

Commit 259c2ab

Browse files
authored
Add Bash scripts for launching VS Code with activated env (dotnet#33236)
1 parent 9610de0 commit 259c2ab

File tree

7 files changed

+59
-0
lines changed

7 files changed

+59
-0
lines changed

src/Antiforgery/startvscode.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
repo_root="$DIR/../.."
5+
"$repo_root/startvscode.sh" $DIR

src/Azure/startvscode.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
repo_root="$DIR/../.."
5+
"$repo_root/startvscode.sh" $DIR

src/Caching/startvscode.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
repo_root="$DIR/../.."
5+
"$repo_root/startvscode.sh" $DIR

src/Components/startvscode.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
repo_root="$DIR/../.."
5+
"$repo_root/startvscode.sh" $DIR

src/DataProtection/startvscode.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
repo_root="$DIR/../.."
5+
"$repo_root/startvscode.sh" $DIR

src/Mvc/startvscode.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
repo_root="$DIR/../.."
5+
"$repo_root/startvscode.sh" $DIR

startvscode.sh

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

0 commit comments

Comments
 (0)