[release/7.x] Scripts to launch VS and VS Code using local SDK (#2641)
Co-authored-by: Justin Anderson <jander@microsoft.com>
This commit is contained in:
Родитель
d238585970
Коммит
79aac685b5
|
@ -37,5 +37,4 @@ $slnFile = Get-Content $devSln
|
|||
#dotnet sln uses an older ProjectType Guid
|
||||
$slnFile -replace 'FAE04EC0-301F-11D3-BF4B-00C04F79EFBC', '9A19103F-16F7-4668-BE54-9A1E7A4F7556' | Out-File $devSln
|
||||
|
||||
$devenvPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -prerelease -property productPath
|
||||
& $devenvPath $PSScriptRoot\dotnet-monitor.dev.sln
|
||||
& "$PSScriptRoot\startvs.cmd" $PSScriptRoot\dotnet-monitor.dev.sln
|
|
@ -0,0 +1,33 @@
|
|||
@ECHO OFF
|
||||
SETLOCAL
|
||||
SETLOCAL EnableDelayedExpansion
|
||||
|
||||
:: This command launches a Visual Studio solution with environment variables required to use a local version of the .NET Core SDK.
|
||||
|
||||
:: This tells .NET Core to use the same dotnet.exe that build scripts use
|
||||
SET DOTNET_ROOT=%~dp0.dotnet
|
||||
SET DOTNET_ROOT(x86)=%~dp0.dotnet\x86
|
||||
|
||||
:: This tells .NET Core not to go looking for .NET Core in other places
|
||||
SET DOTNET_MULTILEVEL_LOOKUP=0
|
||||
|
||||
:: Put our local dotnet.exe on PATH first so Visual Studio knows which one to use
|
||||
SET PATH=%DOTNET_ROOT%;%PATH%
|
||||
|
||||
SET sln=%~1
|
||||
|
||||
IF NOT EXIST "%DOTNET_ROOT%\dotnet.exe" (
|
||||
echo .NET Core has not yet been installed. Run `%~dp0restore.cmd` to install tools
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
IF "%sln%"=="" (
|
||||
SET sln=%~dp0dotnet-monitor.sln
|
||||
echo Automatically chose solution file !sln!
|
||||
)
|
||||
|
||||
IF "%VSINSTALLDIR%" == "" (
|
||||
start "" "%sln%"
|
||||
) else (
|
||||
"%VSINSTALLDIR%\Common7\IDE\devenv.com" "%sln%"
|
||||
)
|
|
@ -0,0 +1,30 @@
|
|||
@ECHO OFF
|
||||
SETLOCAL
|
||||
|
||||
:: This command launches a Visual Studio code with environment variables required to use a local version of the .NET Core SDK.
|
||||
|
||||
:: This tells .NET Core to use the same dotnet.exe that build scripts use
|
||||
SET DOTNET_ROOT=%~dp0.dotnet
|
||||
SET DOTNET_ROOT(x86)=%~dp0.dotnet\x86
|
||||
|
||||
:: This tells .NET Core not to go looking for .NET Core in other places
|
||||
SET DOTNET_MULTILEVEL_LOOKUP=0
|
||||
|
||||
:: Put our local dotnet.exe on PATH first so Visual Studio knows which one to use
|
||||
SET PATH=%DOTNET_ROOT%;%PATH%
|
||||
|
||||
:: Sets TFW for Visual Studio Code usage
|
||||
SET TARGET=net7.0
|
||||
|
||||
SET folder=%~1
|
||||
|
||||
IF NOT EXIST "%DOTNET_ROOT%\dotnet.exe" (
|
||||
echo .NET Core has not yet been installed. Run `%~dp0restore.cmd` to install tools
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
IF "%folder%"=="" (
|
||||
code .
|
||||
) else (
|
||||
code "%folder%"
|
||||
)
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# This command launches a Visual Studio code with environment variables required to use a local version of the .NET Core SDK.
|
||||
|
||||
# This tells .NET Core to use the same dotnet.exe that build scripts use
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
export DOTNET_ROOT="$DIR/.dotnet"
|
||||
|
||||
# This tells .NET Core not to go looking for .NET Core in other places
|
||||
export DOTNET_MULTILEVEL_LOOKUP=0
|
||||
|
||||
# Put our local dotnet on PATH first so Visual Studio knows which one to use
|
||||
export PATH="$DOTNET_ROOT:$PATH"
|
||||
|
||||
# Sets TFW for Visual Studio Code usage
|
||||
export TARGET=net7.0
|
||||
|
||||
if [ ! -f "$DOTNET_ROOT/dotnet" ]; then
|
||||
echo ".NET Core has not yet been installed. Run `./restore.sh` to install tools."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
code .
|
||||
else
|
||||
code $1
|
||||
fi
|
Загрузка…
Ссылка в новой задаче